[Templates] Appending HTML to a var ............

Anthony Gardner cyclewood_ltd at yahoo.co.uk
Fri Dec 7 18:04:11 GMT 2007


It just so happens, while cycling home in the wind and the rain, that I realised I was approaching it from the wrong direction. I should just be putting the data I need in one of two lists and once that's all done, I can just loop through those lists and filling in the HTML.

But, it it possible to add/append raw html code to a var of some type for later use or is my method above The Way to do it?

-Ants

Josh Rosenbaum <josh at infogears.com> wrote: Anthony Gardner wrote:
> .......... for later 'shoving out to display'.
> 
> I'm trying to append some html and data to two vars and display them at 
> a later date. I've tried appending to a normal string, pushing onto a 
> list, using String.new and append ........ but nothing but hair pullling.
> 
> When using the method below, it just shoves the html straight out to 
> display, with list or String, I have a problem with the html tags even 
> when trying to escape them.
> 
> I can;t think anymore ....... need tea. Need help, please and then we 
> can add a big site to the list of sites ;)
> 
> 
> pseudo ...
> FOREACH somelist
>   IF sth == 'new'
>     new = new _ 'New
>   ELSE
>     old = old _ 'Old
>   END
> END
> 
> [% new %]
> [% old %]
> 
> Merci (mercy on me) -Ants

That pseudo code looks mostly fine. (Although there are no ending quotes after the  or semi-colons.) Give us some real code and we can probably help you out here. Or implement your psuedo code and post it if you still can't get that to work.

-- Josh

_______________________________________________
templates mailing list
templates at template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates



Disclaimer: Technically, I'm always wrong!!
       
---------------------------------
 Sent from Yahoo! &#45; a smarter inbox.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20071207/c493848d/attachment.htm 


More information about the templates mailing list