[Grok-dev] "Apply" a pagetemplate to an object and get html back
Lennart Regebro
regebro at gmail.com
Fri Jul 18 16:41:38 EDT 2008
On Fri, Jul 18, 2008 at 21:16, Achim Domma <domma at procoders.net> wrote:
> Hi,
>
> how do I apply a template to an object an get the html code back? To learn
> grok, I'm developing some kind of yet-another-mini-cms. I want to let the
> user edit the page body via a webform using textile or markdown for example.
> Then I would provide tags to display some kind of specialized lists like
> "events", "links", ...
>
> How do I do that using grok? Or is there a better approach to solve my
> problem?
You create a View. This object will sit "inbetween" the object and the template.
so:
class TheObject(grok.Model):
blablabal
class TheView(grok.View):
blablabla
theview = Template("<html>abasdjasbksdaksdjak</html>")
This will give you a /template on all TheObject objects, that will
render the template.
--
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64
More information about the Grok-dev
mailing list