Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Change Link-Template for Modify

Quote Reply
Change Link-Template for Modify
Hi all, i have different link.html for every category.
If someone wants to modify his link, the modify_select uses link.html.

Now im looking for the place where this is written ?!
modify.cgi uses modify.pm; this calls SiteHTML.pm

But i dont find the right line, where it says take the sub site_html_link
there i have something like:

Code:
my $template;
if ($rec->{Link_Template} eq 'Programme') {$template="link_programme.html";}
else {$template= "link.html";}

Now i must pass $rec->{Link_Template} from the Cat Table to sub site_html_link;
but where could i do that ?
Robert
Quote Reply
Re: [Robert] Change Link-Template for Modify In reply to
Hi,

This is actually in the template:

Code:
<%loop link_results_loop%>
<tr><td valign=top><input type=radio name=LinkID value="<%ID%>" align=top></td>
<td>
<%Links::Utils::load_link%>
</td></tr>
<%endloop%>


You can remove <%Links::Utils::load_link%> and replace it with something else to display the link.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Change Link-Template for Modify In reply to
Hi Alex, thank you. That´s clear so far.
But i need a way to ask:

When i want to show link.html for different cats; i pass a value from the cat table and ask something like:

if category = toys then use link_toys.html ...

The same i have to do for search, for modify, add ...
Maybe i should take a look to the :utils.pm ...

Robert
Quote Reply
Re: [Robert] Change Link-Template for Modify In reply to
All Link::Utils::load_link is is:

Code:


sub load_link {
# -------------------------------------------------------------------
# This will return a fully formatted link.
#
my $tags = GT::Template->tags;
return Links::SiteHTML::display('link', $tags);
}


If you remove that, and instead make a global that takes the parameter the template you want to use:

<%load_link_template('link_category_x')%>

And create a template global:

load_link_template => sub {
my ($template_name) = @_;
my $tags = GT::Template->tags;
return Links::SiteHTML::display($template_name, $tags);
}

Not tested, but should work.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Change Link-Template for Modify In reply to
Not a biggie but:

my ($template_name) = @_;

Should/could be:

my ($template_name) = shift;