Gossamer Forum
Home : Products : Links 2.0 : Customization :

advanced help: multiple templates

Quote Reply
advanced help: multiple templates
Hi.
I would like to use different templates to modify resources. A different template.html for every category.
I tried to modify site_html_templates.pl in sub modify form but the variable if $category_name or $category is not working.
Quote Reply
Re: advanced help: multiple templates In reply to
Just in case you didn`t find it. Here is a message posted by our friend Bobsie some months ago. I saved and here it is.
Thanks to BOBSIE.

Find this:

sub site_html_category {
# --------------------------------------------------------
# This rountine will build a page based for the current category.

return &load_template ( 'category.html', {

And replace with the text below. (You also have to replace the categories with the categories of your choice.) Create one new template.html file for each category you add.


sub site_html_category {
# -------------------------------------------
my $template;

# Set the appropriate template file to load
if ($category_name =~ "Accommodation") { $template = "accommodation.html"; }
elsif ($category_name =~ "Arts") { $template = "arts.html"; }
elsif ($category_name =~ "Entertainment") { $template = "entertainment.html"; }
elsif ($category_name =~ "Food ") { $template = "food.html"; }
elsif ($category_name =~ "Travel ") { $template = "travel.html"; }
else { $template = "category.html"; }


T.J.

[This message has been edited by TJ (edited September 12, 1999).]
Quote Reply
Re: advanced help: multiple templates In reply to
There are a few Threads that discuss using different category templates. Please use the search option to find them.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: advanced help: multiple templates In reply to
HEY!
Can this be done similarly for "What's Cool" and "Top Rated?" If so, please let me know! also, if the above code needs to be modified for the "What's Cool" or "Top Rated" categories, please let me know how so.


- Well....

I was going to delete this message entirely, but it appears I cannot. I answered my own question. Yes, this can be used to modify What's Cool and such, but it's not necessary. What I jumped the gun about was thinking that I might be able to use this code to use a differen link.html template for What's Cool than for other pages. I've got another thread going where I'm trying to solve this problem, so I won't turn this one into a different subject.

-Greg

[This message has been edited by Greg Gaub (edited September 12, 1999).]
Quote Reply
Re: advanced help: multiple templates In reply to
The problem is:
I used that routine but it doesn't work. The variable $category_name is working only in sub link ....not in sub modify.
Quote Reply
Re: advanced help: multiple templates In reply to
fak,

You cannot do that for modifies because there is no way to know the category of the link being modified until the user enter its.