Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Template question

Quote Reply
Template question
I want to create a specific template for a category and all its subcategory, I know that I can use the "Category Template" for this, but all I need is to change just one template (include_header.html) and I need to do this in some category.
So I think maybe instead created a lot of unique template by using the "Category Template" there is a way to use the same logic of the "Category Template" but just for one change.

Last edited by:

nir: Oct 12, 2008, 4:04 AM
Quote Reply
Re: [nir] Template question In reply to
Hi,

You could add a new field in your Category table, like:

CustomCatHeader / CHAR(255) / TEXT

..then, for the categories you want a different header in, enter the filename.html.

Then, in category.html, change:

Code:
<%include include_header.html%>

..to:

Code:
<%if CustomCatHeader%>
<%include $CustomCatHeader%>
<%else%>
<%include include_header.html%>
<%endif%>

...this should then load the custom "header" file for your category.

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Template question In reply to
Thanks
I want it to work like the "Category Template" so I will not need to do this for every sub category. So like the "Category Template" there will be a category that all its subcategory will use this CustomCatHeader.
Quote Reply
Re: [nir] Template question In reply to
Hi,

Thats not so easy ;)

All I could recommend - is doing a SQL statement to update the sub-categories, like so:

UPDATE glinks_Category SET CustomCatHeader = 'your_include_file.html' WHERE Full_Name LIKE 'Category_To_Update/%'

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Template question In reply to
Is there a way to create a global that will take the category ID and will check if in the category there is CustomCatHeader column and if not it will check upper category until it will find a category with CustomCatHeader and will take its value ?
Quote Reply
Re: [nir] Template question In reply to
Hi,

Well, what could be done - is to find the root father, and get the value for that category. For example, if you have:

Top Category
Top Category/Sub one
Top Category/Sub 2
Top Category/Sub 3
Top Category/Sub 3/Test
Top Category/Sub 3/Test 2

..then the global would extract the "Top Category" bit, and check if "Top Category" has a value for CustomCatHeader.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Template question In reply to
There is small problem that it not just the top category that will have CustomCatHeader, is that I have subcategory that need CustomCatHeader, so the subcategory are function like top category regards the CustomCatHeader. Because of that I was thinking to find if the category have CustomCatHeader and if not to look upper category up to the real Top Category and when the globale find the first CustomCatHeader it stop to run.
Quote Reply
Re: [nir] Template question In reply to
Hi,

Well, it could be done - but I don't have time to do it at the moment. I'll try and have a look at it later (willl require some testing too, not just a simple case of writing the global ;))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!