i would like to highlight search terms in a html page of search
results, by passing an array of scalars which are the search terms.
this is my code without highlighting. the string i want to add the
highlighting markup to is c.postaladdress . i would need to supply two
arguments: an array 'terms', and the markup to use, e.g. "<span
class="term"></span>".
[% FOREACH c = results %]<tr class="[% next_rowclass() %]"><td
class="numCol"><a href="[% c.id %]">[% c.id %]</a></td><td>[%
c.postaladdress FILTER html %]</td></tr>
[% END %]</table>
perhaps i could have something like this:
[% c.postaladdress FILTER html FILTER highlight(terms, "<span
class='term'>", "</span>") %]
is there any obvious/idiomatic way to do this in TT? i don't really
know whether to write a filter or just some plain perl code that
matches the terms against the output and spits out a scalar which i can
use in the template instead of c.postaladdress.
could somebody with TT experience advise whether this is a good idea?
i'm not really looking for a complete answer as much as a point in the
right direction.
TIA,
-vincent
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates
- Re: [Templates] highlight search terms google-cache-sty... Vincent D Murphy
- Re: [Templates] highlight search terms google-cach... darren chamberlain
