AlanMorris Posted January 22, 2008 Share Posted January 22, 2008 Hi I am using css to set a background image for a 'div' in a template but want to have a different background image for the 'div' in each page. Can I set up a php variable in each page so that I can have a different image for the 'div' using 1 template. i.e. I have a site that uses one template but the background for the building page needs to have a building.jpg image set whilst the food page (using the same template) needs a food.jpg set for 'div' background. Heeeeellllppppp ??? Quote Link to comment https://forums.phpfreaks.com/topic/87207-set-php-page-variable-to-set-an-image-background-in-css/ Share on other sites More sharing options...
kenrbnsn Posted January 22, 2008 Share Posted January 22, 2008 This article should give you some hints. Ken Quote Link to comment https://forums.phpfreaks.com/topic/87207-set-php-page-variable-to-set-an-image-background-in-css/#findComment-446074 Share on other sites More sharing options...
AlanMorris Posted January 22, 2008 Author Share Posted January 22, 2008 Can I do something like this CSS #contentWrapper{ background-image:url(../images/$_COOKIE); background-repeat:repeat; } HTML <?php $_COOKIE[bgroundimg.jpg]?> <div id="contentWrapper">this section would have the image set in the variable $_bground set as it background</div> Quote Link to comment https://forums.phpfreaks.com/topic/87207-set-php-page-variable-to-set-an-image-background-in-css/#findComment-446100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.