Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Field Category_Template in Cat-Definition

Quote Reply
Field Category_Template in Cat-Definition
Cause i want not only different Templates for each cat, but the same for links and detailed;
i have watched for the way it goes in Links/SiteHTML.pm.
Now i need the same way as done in 1.13
Two additional fields for every cat with Link_Template and Detailed_Template.
Then changing code from

return Links::user_page ('link.html', $rec, $opts);

to:

my $template = "link.html";
return Links::user_page ($template, $rec, $opts);

The problem to solve: How to pass the values of a column in cat-table to the sub for the links?

Robert

Last edited by:

Robert: Feb 10, 2002, 6:27 PM
Quote Reply
Re: [Robert] Field Category_Template in Cat-Definition In reply to
Ok, here we go with the small solution:
Instead of saying it tru the cat, we say it for every link with two additional fields:
Link_Template and Detail_Template; we put both as enum init and make a choice of our additional templates:

Then we change the siteHTMl in sub site_html_link and _detail like this:

my $template;
if ($rec->{Detail_Template} eq 'Programme') {$template="det_programme.html";}
elsif ($rec->{Detail_Template} eq 'Content') {$template="det_content.html";}
else {$template= "detailed.html";}

my $output = Links::user_page ($template, $rec, $opts);

Instead of parsing:
my $output = Links::user_page ('detailed.html', $rec, $opts);

we ask for every link for the value of the field Detail_Template and give the right template-file.
For my needs that is enough. Maybe it would be better to pass a value defined in the category-table.

For site_html_link its the same.


Robert

BTW: Have still no clue about plugs, maybe someone could do this for all others?!