[SOLVED] Display Header BG according to page alias?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

[SOLVED] Display Header BG according to page alias?

Post by CapereSpiritum »

Hi

I've a fishing website that I've recently converted to CMSMS.
Best Fishing

It used to be a complicated static site but after conversion I've lost the ability to display a header image according to the section of the website.

In the old site I had a class in the body tag like this;

Code: Select all

</__body class=coarse-fishing>
And a css class in the header TD like this

Code: Select all

<td class="Header" id="headerimage">
The CSS to call the image is this

Code: Select all

BODY.coarse-fishing #headerimage {
	BACKGROUND: url(Fishing_Tackle/Images/Header-Tench.gif) no-repeat left top
}
I'm attampting to do similar but using {page_alias} and an apropriately named image.

Now using 'divs'. Header div is called 'header'

Anyone know what the correct CSS is?
Last edited by CapereSpiritum on Wed Oct 24, 2012 12:02 pm, edited 1 time in total.
gianpiero
Forum Members
Forum Members
Posts: 221
Joined: Sun Jan 07, 2007 4:32 pm

Re: Display Header BG according to page alias?

Post by gianpiero »

I'm very interested in this.
I solved with differents templates and stilesheets, changing only header, logo, but this is no possible when there are too many sections
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Display Header BG according to page alias?

Post by velden »

Are you aware of the possibility to choose an image in the options tab while creating/editing a page?

If that's not what you're looking for take a look at the tag {content_image}. It gives the user/you the possibility to choose an image per page.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Display Header BG according to page alias?

Post by Dr.CSS »

</__body class='{$page_alias}'>
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Display Header BG according to page alias?

Post by applejack »

Install and use CGISimpleSmarty module then you can easily use images based upon section.
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

Re: Display Header BG according to page alias?

Post by CapereSpiritum »

gianpiero wrote:I'm very interested in this.
I solved with differents templates and stilesheets, changing only header, logo, but this is no possible when there are too many sections
That seemed the most practical way to go.
Thanks all

Take a look Best Fishing
gianpiero
Forum Members
Forum Members
Posts: 221
Joined: Sun Jan 07, 2007 4:32 pm

Re: [SOLVED] Display Header BG according to page alias?

Post by gianpiero »

yes
it's an easy solution, works and easy to apply.
I've never searched for a better solutions but I'sure that exist, based upon the other suggestions of this topic

gianpiero
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [SOLVED] Display Header BG according to page alias?

Post by applejack »

Using differents templates and stylesheets is not the way to go as it increases maintenance and admin time and is not necessary. You should make as few as possible. You can do lots of useful things by utilising the url i.e. {$page_alias} Take a look at CGISimpleSmarty it is well worth it. Also you should use global content blocks as much as possible in templates such as for the head and footer, search block, main menu etc
Post Reply

Return to “Layout and Design (CSS & HTML)”