Hi there,
I'm using HTML::Template to produce a website, and I'm trying to avoid a link to the current page, because Jakob Nielsen says it's a good idea. (Note that I still think PerlMonks should continue with its static links, because of the frequency that pages are returned after HTTP POST requests)

I've got a common menu which is <TMPL_INCLUDE>'d into every template file, and I'm using CGI::Application's cgiapp_prerun() method to set certain values.

cgiapp_prerun: (paraphrased slightly, forgive typos)

sub cgiapp_prerun { my $self = shift; my $q = $self->query(); my $runmode = $self->get_current_runmode(); return unless(exists $template_files{$runmode}); $self->{"_html_template"} = HTML::Template->new(filename => $t +emplate_files{$runmode}, associate => $q); $self->{"_html_template"}->param($runmode => 1); }

Now in my common.tmpl file:

<TMPL_IF NAME="mode9"> Customer Search<br /> <TMPL_ELSE> <a href="support.pl?rm=mode9">Customer Search</a><br / +> </TMPL_IF> <TMPL_IF NAME="mode11"> Kit Search<br /> <TMPL_ELSE> <a href="support.pl?rm=mode11">Kit Search</a><br /> </TMPL_IF>
Obviously that will become huge once you've got more than a couple of choices.

Does anyone have any suggestions for preventing the appearance of current-page links without the duplication above?
Should I just carry on using this technique? after all, the users' time is more valuable (there's more of them, they use it often).

Update: Forgot to mention that I'm aware I could simply do away with the text when I'm in that runmode, but I believe the "jumping menu" effect would be jarring.


davis
It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.

In reply to Avoiding links to current page with HTML::Template by davis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.