SimplePortal

Customization => Custom Coding => Topic started by: The Wizard on October 30, 2010, 10:41:57 AM

Title: Background Images in Pages??
Post 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 :(
Title: Re: Background Images in Pages??
Post by: 130860 on October 30, 2010, 08:04:46 PM
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
Title: Re: Background Images in Pages??
Post by: The Wizard on October 30, 2010, 08:53:45 PM
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 -
Quote
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

Title: Re: Background Images in Pages??
Post by: 130860 on October 31, 2010, 09:27:38 AM
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 
Title: Re: Background Images in Pages??
Post by: The Wizard on October 31, 2010, 10:23:25 AM
To: 130860

Thank you very much for the help the code worked like a dream!

SimplePortal 2.3.8 © 2008-2024, SimplePortal