【问题标题】:(Datalife Engine) PHP Random Image Rotation picture is not showing up [closed](Datalife引擎)PHP随机图像旋转图片未显示[关闭]
【发布时间】:2014-09-24 16:20:30
【问题描述】:

我对这个 roate.php 有疑问。

我做了这里描述的一切 PHP Random Image Rotation .但是出现了图片。 这就是我的代码的样子。

style.css

.header_img {
overflow: hidden;
width: 1010px;
margin: 0 auto;
height: 276px;
background: url(../header/rotate.php) no-repeat center 0;
border-width: 0 1px;

main.tpl

    <!-- /header --> 
</header>
<div id="header_img">
  <div class="header_img"><!-- no text --></div>
</div>

我是一个初学者,这对我来说都是新的。所以我希望有人能在这里帮助我。

最好的问候

【问题讨论】:

  • 在浏览器中打开rotate.php并检查php是否正确渲染图像。

标签: php css datalife-engine


【解决方案1】:

您遇到的问题不是rotate.php和dle脚本的问题,而是“rotate.php”文件位置的问题,您不能在主题文件夹中放置任何php文件,它将被阻止通过脚本和htaccess,所以解决方案很简单,在“templates”文件夹之外的根目录中创建新文件夹,例如:“header”或“background”

然后把所有图片和rotate.php放到那个文件夹里面,这样你就可以访问文件夹和图片了

http://your-domain.com/header/rotate.php
http://your-domain.com/header/image-1.php
http://your-domain.com/header/image-2.php
...
or
---
http://your-domain.com/background/rotate.php
http://your-domain.com/background/image-1.php
http://your-domain.com/background/image-2.php

你的 main.tpl 应该是这样的

<style type="text/css">
.header_img {
overflow: hidden;
width: 1010px;
margin: 0 auto;
height: 276px;
background: url(/header/rotate.php) no-repeat center 0;
/* or */
/*
background: url(/background/rotate.php) no-repeat center 0;
*/
border-width: 0 1px;
</style>
    <!-- /header --> 
</header>
<div id="header_img">
  <div class="header_img"><!-- no text --></div>
</div>

将任何 php 文件从“模板”文件夹中取出。并且不要将 css 放在任何 css 文件中,将所有代码放在 main.tpl 中。

或者,您可以使用我们在为他们设计的一些网站中使用的这种技术

1) 从A List Apart下载rotator.txt,重命名为rotator.php。

2) 将要旋转的图片和rotator.php放在同一目录下。

3) 通过 FTP 上传所有文件。

4) 在 main.tpl 中添加这段代码

<style type="text/css">
#rotator{
overflow: hidden;
width: 1010px;
margin: 0 auto;
height: 276px;
background: url(/background/rotate.php) no-repeat center 0;
border-width: 0 1px;
</style>
    <!-- /header --> 
</header>
<div id="rotator">&nbsp;</div>

【讨论】:

  • DLE 将 php 文件放置在模板文件夹中存在一些问题,这一定是 rorate.php 无法正常工作的原因
猜你喜欢
  • 2012-06-10
  • 1970-01-01
  • 2015-07-03
  • 1970-01-01
  • 1970-01-01
  • 2013-07-10
  • 2013-06-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多