Design:Blog.html
From Katapulta
(Difference between revisions)
m |
m (→Variabile) |
||
Line 45: | Line 45: | ||
==Variabile== | ==Variabile== | ||
+ | În template-ul ''blog.html'' pot fi accesate următoarele variabile: | ||
* <pre>blog</pre> - are următoarele atribute | * <pre>blog</pre> - are următoarele atribute | ||
** <pre>blog.all_posts</pre> - lista cu toate articolele | ** <pre>blog.all_posts</pre> - lista cu toate articolele | ||
** <pre>blog.catagories</pre> - lista categoriilor de articole | ** <pre>blog.catagories</pre> - lista categoriilor de articole |
Latest revision as of 13:29, 28 April 2011
Acest template afișează articolele din blogul magazinului tău.
Se pot afișa toate articolele din blog sub forma unei liste:
<h2>Shop Blog</h2>
<ul id="post-list">
{% for post in blog.all_posts %}
<li>
<h4><a href="{{ post.url }}">{{ post.title }}</a></h4>
<p>
{{ post.content|nl2br|truncate(400) }}
<span class="readmore"><a href="{{ post.url }}">« citeste mai mult</a></span>
</p>
</li>
{% endfor %}
</ul>
Sau articolele grupate pe categorii:
<ul id="blog-categories">
{% for category in blog.categories %}
<li id="category_{{ category.id }}">
<a href="{{ category.url }}" title="{{ category.title|e }}">{{ category.title|e }}</a>
<ul id="postlist-category_{{ category.id }}">
{% for post in category.posts %}
<li>
<h4><a href="{{ post.url }}">{{ post.title }}</a></h4>
<p>
{{ post.content|nl2br|truncate(400) }}
<span class="readmore"><a href="{{ post.url }}">« citeste mai mult</a></span>
</p>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
Variabile
În template-ul blog.html pot fi accesate următoarele variabile:
-
blog
- are următoarele atribute-
blog.all_posts
- lista cu toate articolele -
blog.catagories
- lista categoriilor de articole
-