chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Ersatz question


From: Matt Gushee
Subject: [Chicken-users] Ersatz question
Date: Tue, 5 Mar 2013 23:07:13 -0700

Hi, folks--

I am trying again to learn how to use Ersatz. I am trying to render pages that display sequences of similar components (e.g. blog posts). The template syntax includes 'for' loops, e.g.

  {% for p in posts %}
  <div class="blog-post">
    <h3>{{ p.title }}</h3>
    <div class="post-body">
      {{ p.body }}
    </div>
  </div>
  {% endfor %}

Or ... I'm pretty sure the following would work in Jinja2 (where the 'posts' variable is a list in the form [[<post>, <body>] ...]):

  {% for title, body in posts %}
  <div class="blog-post">
    <h3>{{ title }}</h3>
    <div class="post-body">
      {{ body }}
    </div>
  </div>
  {% endfor %}

So, do these constructs work in ersatz? If so, what data structures do I want to pass as the models: argument when rendering the templates?

Thanks for any info!

--
Matt Gushee

reply via email to

[Prev in Thread] Current Thread [Next in Thread]