On Mon, Mar 13, 2006 at 04:41:15PM -0600, Kapoor, Nishikant wrote: >For populating loops, I get the resultset from db, and assign it directly to >the loop_var. This works wonderfully for most cases, except where there is a >need to process each row before assigning it to the template. One particular >case is where I am retrieving a resultset after a search query, and I need to >highlight the text that was searched for. > >Is there a way I can continue to use the 'single' assignment, and still >achieve this objective?
Well, you could cheat and roll the loop into a map statement... my $data = &getDataFromDB; map {$data[$_]{bold}=1} 0..$#{$data}; $template->param(myLoopVar => $data); and have a <tmpl_if name=bold><b></tmpl_if> <tmpl_var name=title escape=html> <tmpl_if name=bold></b></tmpl_if> You really shouldn't be putting html markup into template parameters anyway, without a very good reason. Roger ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users