On Sun, Jun 14, 2009 at 10:42 PM, Seth<
seediff...@gmail.com> wrote:
>
> Hey guys,
>
> I'm having some trouble with WebHelpers (TG 2.0 with Mako templates).
> The documentation seems to be a bit misleading/confusing about
> accessing helpers from within the templates (in some places it says to
> that I can't seem to find a bunch of the methods such as
> use h.html.tags, in others I've seen helpers.html.tags), but on top of
this is because one letter variables are deprecated in pylons and will
be removed in future versions. Currently both 'h' and 'helpers' both
point to your projects /lib/helpers , but use helpers for forward
compatibility.
> html.link_to_if, html.link_to_unless, html.tags.stylesheet_link, etc.
>
not everything is imported again see your lib/helpers to pull in the content.
> In my Mako templates I've managed to get ${h.html.HTML.a('Home
> href=tg.url('/'))} working, but it seems like there should be a
> simpler way.
>
That is correct the default path is that long.
h = tg template variable
html = webhelpers main html generator module
HTML = instance of the "content builder"
a = method of HTML
This the the content of one of my helpers package
from webhelpers import date, feedgenerator, html, number, misc, text
from webhelpers.rails.number import number_to_phone
the first line is the default which I haven't bothered to remove. The
second one allows me to do ${h.number_to_phone(str)}
yes indeed.
> Thanks,
> Seth
> >
>