Page 2 of 2
Re: Change page background for individual pages
Posted: Fri Aug 27, 2010 2:15 am
by Dr.CSS
I use it all the time as a class for body...
Then in css...
.pagealias #header {image call and other styles}
Or I use it on the very first div like pagewrapper...
Re: Change page background for individual pages
Posted: Mon Sep 06, 2010 9:44 pm
by simon.romin
Hi!
Thanks for all your very helpful feedback on this! Hopefully somebody else searching will find this thread useful too.
But I have a similar request:
How can I change my header background image for a particular category?
This is quite common across many websites. The only example I can find at this present moment is:
http://www.hannsg.com/EU/EN/Products/LC ... ommon.aspx
Can you see what I mean?
Looking forward to any help!
Simon
Re: Change page background for individual pages
Posted: Tue Sep 07, 2010 9:52 pm
by simon.romin
Hi guys,
Any thoughts on how to change the category background?
Cheers,
Simon
Re: Change page background for individual pages
Posted: Wed Sep 08, 2010 12:22 am
by curlypinky
Same idea as using css for individual pages but instead of getting the page_alias you want to get the root or parent alias. Depending on your setup (so if you have cat1 is 2.0, and cat 2 is 3.0 etc you'd be fine with root alias. But if your categories are deeper, lets say 2.1 and 2.2 are the categories and the 3rd level is the children, you'd want to get just the patent alias so you'd end up with the alias of 2.1 when you are on page 2.1.1. CalGuy's SimpleSmarty module is awesome for this (
CGSimpleSmarty http://dev.cmsmadesimple.org/projects/cgsimplesmarty).
# get_parent_alias([$alias],[$assign])
Returns the alias of the specified pages parent. Returns an empty string if there is no parent.
Arguments:
* [$alias] - (optional) The page alias to find the parent of. If no value is specified, the current page is used.
* [$assign] - (optional) The name of a variable to assign the results to.
Example:
The parent page alias is {$cgsimple->get_parent_alias()}
# get_root_alias([$alias][,$assign])
Returns the alias of the specified pages root parent. Returns an empty string if there is no root parent.
Arguments:
* [$alias] - (optional) The page alias to find the root parent of. If no value is specified, the current page is used.
* [$assign] - (optional) The name of a variable to assign the results to.
Example:
The root parent page alias is {$cgsimple->get_root_alias()}
So just make sure your template is assigning a body class for the parent or root:
get_root_alias()}' id='{$page_alias}'>
And your css has the call for the appropriate header image in there ala:
body.rootalias1 #headerWrapper {background...}
body.rootalias2 #headerWrapper {background...}
Alane
Re: Change page background for individual pages
Posted: Wed Sep 08, 2010 8:15 pm
by simon.romin
Hi,
Thanks for the very useful reply!
Is it possible to do this without using CGSimpleSmarty?
Thanks
Simon
Re: Change page background for individual pages
Posted: Wed Sep 08, 2010 9:57 pm
by curlypinky
That I don't know, I would assume it is possible... but I don't think CalGuy would have gone to the trouble of creating CGSimpleSmarty with such functions if it could be done easily without it.
Alane