I prefer to handle this type of thing in the program logic rather than the template itself. What I'll do is create a template loop with a single generic link, and pass a value in the array indicating whether it should be linked or unlinked.
<TMPL_LOOP NAME="links">
<TMPL_IF NAME="linked">
<a href="<TMPL_VAR NAME="link_url">">
<TMPL_VAR NAME="link_text"></a>
<TMPL_ELSE>
<TMPL_VAR NAME="link_text">
</TMPL_IF>
</TMPL_LOOP>
Then I can build an array for the loop, using something like this: (untested)
my $CUR_MODE = ## (the current mode)
my %modes => ('mode9 => 'Customer Search',
'mode11' => 'Kit Search');
my @menu;
for(keys %modes) {
push @menu, { link_url => 'http://foo.com/?' . $_,
link_text => $modes{$_}
$_ eq $CUR_MODE ? (linked => 0) : (linked => 1) }
That will check to see which menu item corresponds to the current mode and decide whether to link it on-the-fly. You can wrap that in a function and use it in every mode, and pass the result to your template.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.