http://yao.appspot.com/init/default/showblogpost/3016

2009/3/1 Greg Fuller <[email protected]>

>
> Nice; thanks!
>
> On Feb 28, 10:44 pm, mdipierro <[email protected]> wrote:
> > Mind that you can also define functions in templates. For example
> >
> > {{def link(url):}}<a href="{{=url}}">{{=url}}</a>{{return}}
> >
> > you can put your funcitons in the template that needs them or in a new
> > template (say aux.html) and include it {{include 'aux.html'}}
> >
> > You would then use it with {{link('http://www.web2py.com'}}
> >
> > Massimo
> >
> > On Feb 28, 9:26 pm, Greg Fuller <[email protected]> wrote:
> >
> > > Oh my, I see you can put any python code in a template. I'm not used
> > > to this flexibility (except for a little time with mako).  Now I just
> > > need to figure out scoping for the external functions I want to call.
> >
> > > On Feb 28, 6:26 pm, Greg Fuller <[email protected]> wrote:
> >
> > > > How can custom template tags be implemented in Web2py.
> >
> > > > There are times when it is good to let the template designer "pull"
> > > > information into a template without having the model anticipate
> > > > everything in advance the template might need.  I've used this
> pattern
> > > > a lot with php-smarty, django, expression engine, wordpress etc.
> >
> > > > something like {{products =  getProducts(categories=(5,7,9)
> > > > include_inactive=false) }}
> >
> > > > {{for product in products:}}
> >
> > > > and so on
> >
> > > > I'm probably missing something really simple here, but I've searched
> > > > for variations on "custom template tag" and can't find anything.
> >
> > > > Thanks,
> >
> > > > --greg--
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to