0

我有这个roate.php 的问题。

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

样式.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;

主要的.tpl

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

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

此致

4

1 回答 1

2

您遇到的问题在 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>
于 2014-09-25T02:50:49.377 回答