From 78265e8044fd6c7d6576d1dd4761b1ce0fc80ccf Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 1 Nov 2010 15:37:22 +0100 Subject: [PATCH] moving taglist generation to view helper --- .../blog/views/scripts/index/latest.phtml | 21 +++++-------------- library/Fiktiv/View/Helper/TagList.php | 13 ++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 library/Fiktiv/View/Helper/TagList.php diff --git a/application/modules/blog/views/scripts/index/latest.phtml b/application/modules/blog/views/scripts/index/latest.phtml index a7eac5f..10a9c6f 100644 --- a/application/modules/blog/views/scripts/index/latest.phtml +++ b/application/modules/blog/views/scripts/index/latest.phtml @@ -10,21 +10,10 @@ getContent() ?> - getTags()) { - - echo '
'; - - $tagList = ''; - foreach ($post->getTags() as $k => $t) { - $tagList .= ''.$t.', '; - } - - echo substr($tagList,0,-2); - - echo '
'; - } - ?> - + getTags()) : ?> +
+ tagList($post->getTags(), array('controller' => 'archive', 'action' => 'filter'), 'blog') ?> +
+ \ No newline at end of file diff --git a/library/Fiktiv/View/Helper/TagList.php b/library/Fiktiv/View/Helper/TagList.php new file mode 100644 index 0000000..cf85ab3 --- /dev/null +++ b/library/Fiktiv/View/Helper/TagList.php @@ -0,0 +1,13 @@ + $v) { + $url['tag'] = $v; + $list[$k] = '' . $v . ''; + } + return implode(', ', $list); + } +}