Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

What's the best way to customize the detailed template to do...

Quote Reply
What's the best way to customize the detailed template to do...
Hi,

Thanks to Andy, I was able to customize my include_form.html tempate so that it shows different components depending on the category.

But now I have the need to customize the detailed.html template because of the new additions to my include_form.html template.

What is the best way to to go about customizing it based on the category the item is listed in on the detailed template?

The way we are doing it for the include_form.html template is
Code:
<%if not CatID%>
<%set CatID = $ID%>
<%endif%>

<%if CatID == 75%>
New CAT 75 CONTENT HERE
<%else%>
ALL OTHER
<%endif%>

I tried this same way on the detailed template however it didn't work. My guess is that when the system builds the detailed it must not be looking at the category.

It's simple things we need to change. For example instead of "Description" on the detailed page, we need it to say "Card Price List Description" So if the code Andy gave us for the form template worked in the detailed template it would be great but as I say, it doesn't seem to.

Thanks,
Quote Reply
Re: [Westin] What's the best way to customize the detailed template to do... In reply to
Hi,

Doing it in detailed.html is a little more complex - as category ID is never passed in.

Easiest way, is to make a new global:

get_links_cat_id
Code:
sub {
my $cat_id = $DB->table('CatLinks')->select( ['CategoryID'], { LinkID => $_[0] } )->fetchrow;
return { CatID => $cat_id }
}

Then call at the top of the page, with:

<%get_links_cat_id($ID)%>

You should then be able to do the stuff like:

Code:
<%if CatID == 75%>
New CAT 75 CONTENT HERE
<%else%>
ALL OTHER
<%endif%>

Untested, but should work.

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: [Westin] What's the best way to customize the detailed template to do... In reply to
Ok it may not be elegant, but I just quickly thought of a way to do this and did it.

In my include_form.html template I added a hidden text tag that tells the database that it is to assign the field named templateID the value of 75
I added an extra column to the links properties database named templateID

Then on any page where I need to have text localized for templateID 75, I can use the following code:


Code:
<%if templateID == 75%>
New CAT 75 CONTENT HERE
<%else%>
ALL OTHER
<%endif%>


Doing it this way, I can assign any templateID number that I want dependant on which form the person is submitting by simply adding the hidden text html form field code:
Code:
<input type="hidden" id="templateID" name="templateID" value="75" class="text">


So If I add a third form to run on the include_form.html template, then I might change the value above from 75 to maybe 185 or some other meaningful number to me. That way when it's time to customize the detailed pages I can do so working off of the templateID field in the database and the numbers that it might contain.

Last edited by:

Westin: Apr 28, 2009, 3:48 AM