Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Conditions to specify categories in detailed.html

Quote Reply
Conditions to specify categories in detailed.html
In detailed.html, I'd like to create a condition that would work on ANY subcategory of a particular main category.

I know I can do this using Category_Template like this
<%if Category_Template eq category_idioms.html %>
but I'd prefer to have only one category template, ie category.html.
Likewise, I'd prefer to have only one detailed template, ie detailed.html.

For example, I have several hundred categories arranged as:

Idioms <-- category
Idioms A <-- subcategories
Idioms B
Idioms C
etc to
Idioms Z

Quotes <-- category
Quotes A <-- subcategories
Quotes B
Quotes C
etc to
Quotes Z

How can I tell detailed.html the following (without using Category_Template)?

IF category is Any-Subcategory-of-Idioms THEN do this...

IF category is Any-Subcategory-of-Quotes THEN do this...

Thanks,
--Jo

Last edited by:

iplay: Dec 14, 2014, 9:51 PM
Quote Reply
Re: [iplay] Conditions to specify categories in detailed.html In reply to
Hi,

I can't remember the exact format - but I think this should work:

Code:
<%if Full_Name istart "Whatever/"%>
...run this
<%endif%>

"istart" is telling it to find a string that you give, that matches the "start" of the string. So in the instance of:

Idioms/Idioms A/Idioms B

....then the match would be:

Quote:
Idioms - no match
Idioms/Idioms A - match
Idioms/Idioms A/Idioms B - match

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] Conditions to specify categories in detailed.html In reply to
Many thanks AndySmile

I've just tried your suggestion. I can't get it to work in detailed.html but it does work in category.html.

Using <%GT::Template::dump%>, it seems that Full_Name is not available for detailed pages though it is available for category pages.

Can you see any way to get it working on detailed pages? (It looks as though it's exactly what I need!)

Thanks,
--Jo
Quote Reply
Re: [iplay] Conditions to specify categories in detailed.html In reply to
Hi,

If its not in the detailed page, then you should be able to use the breadcrumb to get it.


Code:
TEST: <%title_loop.1.Name%>

See what that gives. If its the category name, then good - otherwise try:

Code:
TEST: <%title_loop.2.Name%>

This is basically getting the category name out of the breadcrumb. Once you know which one this is held in, just do something like:

Code:
<%if title_loop.1.Name eq "Idioms" and title_loop.length > 2%>
its in Idioms, and a sub-cat of it
<%endif%>

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] Conditions to specify categories in detailed.html In reply to
Many thanks as always, Andy.

I've just done a quick test and it seems to work.

I'll set it all up more thoroughly and confirm how it went later.

THANK YOUWink

Thanks,
--Jo
Quote Reply
Re: [Andy] Conditions to specify categories in detailed.html In reply to
Andy: Just to let you know that it all works well using:

Code:
<%if title_loop.1.Name eq "Idioms" and title_loop.length > 2%>
its in Idioms, and a sub-cat of it
<%endif%>

Thanks again for your advice.

Thanks,
--Jo
Quote Reply
Re: [iplay] Conditions to specify categories in detailed.html In reply to
Glad to hear it Angelic

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!