massimo,
filters... ok but what if I need to make more operations with strings
etc, python operations, imports, parsing something ?
More lines of code.
For example I need to operate on dictionaries ( defining new, parsing
etc )
Theoretically, I can apply filters on controller side... but then
there is one ( or more ) loop more.
On 12 Paź, 23:01, mdipierro <[EMAIL PROTECTED]> wrote:
> You can do both:
>
> 1) Example of passing variables to parent.
> Here is layout.html
>
> <html><body><h1>{{=title}}</h1><p>{{include}}</p></body></html>
>
> and here is an example of index.html
>
> {{title='something'}}
> {{extend 'layout.html'}}
> Hello World
>
> Also are variables returned by the action and defined in models are
> also passed to the parent.
>
> 2) Example of a filter.
> You cannot filter HTML (because it does not make sense since you write
> it) but you can filter TEXT (coming from a variable for example) and
> the output of helpers. For example the following filter replaces
> newlines with <br />, sanitize everything else and wraps everything in
> a <p>.
>
> {{def myfilter(s):}}
> <p>{{=XML(str(s).replace('\n','<br />),sanitize=False)}}</p>
> {{return}}
>
> {{=myfilter("""Any<span>html code that
> you</span> like.""")
> {{=myfilter(H1(SPAN('Hello\nWorld')))}}
>
> Massimo
>
> On Oct 12, 3:42 pm, pigmej <[EMAIL PROTECTED]> wrote:
>
> > thanks for reply.
>
> > Python is templating engine - thats really good.
>
> > But I can only include file in one place and there is no way to change
> > anything in parrent file. That's a minus, and the minor problem for
> > mine.
>
> > The same thing with filters/macros. I need to use the same macro/
> > filter in many files. I cannot find this "option" in web2py
> > templates...
>
> > On 12 Paź, 22:11, yarko <[EMAIL PROTECTED]> wrote:
>
> > > Also - if you want to use Genshi Templates (or try to do something
> > > similar for Jinja2), see the Genshi4web2py.py file and instructions
> > > here:
>
> > >http://mdp.cti.depaul.edu/AlterEgo/default/show/162
>
> > > On Oct 12, 2:59 pm, yarko <[EMAIL PROTECTED]> wrote:
>
> > > > There have been several discussions on this list on the topic - for
> > > > example, look
> > > > throughhttp://groups.google.com/group/web2py/browse_thread/thread/1ef4eea826...
>
> > > > I think a raesonable summary is:
>
> > > > - web2py's templating, being very close to just being Python, is
> > > > likely to continue to be default for some time;
> > > > - some people have written tools to convert skins for other templates
> > > > to convert to web2py, so if it's available graphic designs you want,
> > > > that's one way to go
> > > > - there has been talk about still allowing an interface for other
> > > > engines.
>
> > > > I think interest (beyond one of discussion) has not been strong enough
> > > > for someone to identify all the core web2py things that would have to
> > > > be moved into a module, and rewritten for another template engine.
> > > > This has spurned talk and work about modules for web2py, T2 being one
> > > > example. It has not yet spurned a design analysis of where all the
> > > > boundaries are, and what it would take to implement that.
>
> > > > As for documentation, there's Chapter 5 of the web2py book... but
> > > > basically, the template language is python, the helper functions are
> > > > named after HTML, so you can discover them and use them as you would
> > > > expect (<h2>This Heading</h2> ==> H2('This Heading') ) with all the
> > > > named paramteres that w3c defines to h2 (for example) mirrored in
> > > > H2(). There is a genshi translator (search these forums) and there
> > > > is also Massimo's quick demonstraton of a layout builder - see the
> > > > link onhttp://www.web2py.com. The builder has a link on it to
> > > > download the result of your layout experimentation.
>
> > > > Those are probably good starting places.
>
> > > > Hope this was helpful.
>
> > > > Regards,
> > > > Yarko
>
> > > > On Oct 12, 2:27 pm, pigmej <[EMAIL PROTECTED]> wrote:
>
> > > > > Is there any way to change default template engine in web2py?
>
> > > > > I would like to change it to something better with more features like
> > > > > Jinja2
>
> > > > > Or maybe there is a lot of undocumented things in default template
> > > > > engine ?
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---