SimplePortal
Customization => Custom Coding => Topic started by: The Wizard on October 30, 2010, 10:41:57 AM
-
Hello:
I'm wondering if you can put a background image in a page in the php mode? If so could you please post the entire code to do this? I have try-ed a dozen ways and have not found one that will work.
Note: I want to have diffrent pages with diffrent backrounds.
Any help would be appreciated :(
-
it depends on what you want to do in your php page, for example, a ximple div can do that:
<?php
echo '<div style="background-image:url('urlofmyimage.gif');"> ';
//my code
echo '</div>';
?>
http://www.w3schools.com/css/css_background.asp
-
it depends on what you want to do in your php page, for example, a ximple div can do that:
<?php
echo '<div style="background-image:url('urlofmyimage.gif');"> ';
//my code
echo '</div>';
?>
http://www.w3schools.com/css/css_background.asp
I sorry to say that if you take that code and put it in a SP page in the php mode you get this - Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/class116/public_html/testbb/Sources/Subs-Portal.php(1155) : eval()'d code on line 1
Oh and here is the code I used -
echo '<div style="background-image:url('http://www.classictoysonline.com/testbb/tribe-images/big_backgrounds/lifebig.jpg');"> ';
//my code
echo '</div>';
So what am I doing wrong?
Thanks for the Help
-
the code I put was just for example and the error was in ('urlofmyimage.gif')
you have to scape single quotes with \ like this:
(\'urlofmyimage.gif\')
however, this code will not do nothing unless you give a valid url for your background and somthing to fill out the div
-
To: 130860
Thank you very much for the help the code worked like a dream!