Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   General IT Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=19)
-   -   php question (https://www.cableforum.uk/board/showthread.php?t=33677109)

downquark1 25-04-2011 13:29

php question
 
I have a wordpress blog set up and I want the header image to rotate randomly, so I use this script http://www.alistapart.com/d/randomizer/rotate.txt (rename it to rotate.php)
and put this in CSS file
image:url(images/headers/rotate.php);
background-repeat:no-repeat;
background-position:top;
height:309px;
}


But the when I go to the rotate.php the website returns the text of the script instead of executing it.

How do I get it to execute?

craigj2k12 25-04-2011 13:52

Re: php question
 
image:url(images/headers/rotate.php);

image:
isnt a css property and:
rotate.php is the script file, and cant be added as an image anyway (image=picture)

i havnt used wordpress, is it PHP?
for php, you will want something like:
include 'images/headers/rotate.php';

for HTML you will want
<!--#include file="images/headers/rotate.php" -->

insert this line of code into the page, not the css

downquark1 25-04-2011 14:14

Re: php question
 
the image property was in the original wordpress css file.

I was following the instructions here: http://sonspring.com/journal/easy-ra...ss-backgrounds

And wordpress is php

craigj2k12 25-04-2011 16:08

Re: php question
 
background: url(images/rotator.php);

thats right, you had

image: url(images/rotator.php)

downquark1 25-04-2011 17:13

Re: php question
 
sorry I didn't copy it properly:
this is what doesn't work
#main-img{
width:906px;
background-image:url(images/headers/rotate.php);
background-repeat:no-repeat;
background-position:top;
height:309px;
}

Graham M 25-04-2011 20:17

Re: php question
 
.php files can be linked as images as they can be set to return an encoded image file rather than text, downquark, maybe you could link me to your site so I can take a look

craigj2k12 26-04-2011 00:35

Re: php question
 
but "image:" isnt a css property

downquark1 26-04-2011 12:46

Re: php question
 
Thanks to Graham for solving my problem. Some how some screwy metadata had got inserted into the file without me noticing.

Graham M 26-04-2011 17:25

Re: php question
 
Basically something can converted all of the symbols in the code to HTML characters like &lt; for instance and some data had been inserted that didn't belong which would have corrupted the output images anyway


All times are GMT. The time now is 14:20.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum