Skip to content

Commit

Permalink
Add more complex assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
harrydeluxe committed Aug 15, 2012
1 parent 423f31e commit 541b918
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 4 additions & 1 deletion example/index.php
Expand Up @@ -9,7 +9,7 @@

$liquid = new LiquidTemplate(PROTECTED_PATH.'templates/');

$cache = array('cache' => 'file', 'cache_dir' => PROTECTED_PATH.'cache/');
//$cache = array('cache' => 'file', 'cache_dir' => PROTECTED_PATH.'cache/');
//$cache = array('cache' => 'apc');

$liquid->setCache($cache);
Expand All @@ -26,6 +26,7 @@
array(
'title' => 'Blog Title 1',
'content' => 'Nunc putamus parum claram',
'tags' => array('claram', 'parum'),
'comments' => array(
array(
'title' => 'First Comment',
Expand All @@ -36,6 +37,7 @@
array(
'title' => 'Blog Title 2',
'content' => 'Nunc putamus parum claram',
'tags' => array('claram', 'parum', 'freestyle'),
'comments' => array(
array(
'title' => 'First Comment',
Expand All @@ -53,4 +55,5 @@
);

print $liquid->render($assigns);

?>
18 changes: 15 additions & 3 deletions example/protected/templates/index.tpl
@@ -1,7 +1,7 @@
{% comment %}

This is a comment block
(c) 2011 Harald Hanek
(c) 2012 Harald Hanek

{% endcomment %}
<!DOCTYPE HTML>
Expand All @@ -13,15 +13,27 @@ This is a comment block
<h1>{{ document.title }}</h1>
<p>{{ document.content }}</p>
<p><a href="simple.php">Link to simple.php</a></p>

{% if blog %}
Total Blogentrys: {{ blog | size }}
<ul id="products">
{% for entry in blog %}
<li>
<h3>{{ entry.title | upcase }}</h3>
<p>{{ entry.content }}</p>
Comments: {{ entry.comments | size }}
Comments: {{ entry.comments | size }}
{% assign uzu = 'dudu2' %}
{% assign freestyle = false %}

{% for t in entry.tags %}
{% if t == 'freestyle' %}
{% assign freestyle = true %}
{% endif %}
{% endfor %}

{% if freestyle %}
<p>Blogentry has tag: freestyle</p>
{% endif %}

</li>
{% endfor %}
</ul>
Expand Down

0 comments on commit 541b918

Please sign in to comment.