Nice; thanks!

On Feb 28, 10:44 pm, mdipierro <mdipie...@cs.depaul.edu> 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 <gregf...@gmail.com> 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 <gregf...@gmail.com> 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 web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to