ullCms filter by tags / taggable / tagging
Works for models UllCmsPage and UllCmsContentBlock
/apps/frontend/modules/ullCms/actions/actions.php:
public function executeShowExample(sfRequest $request) { $q = new UllQuery('UllCmsPage'); if ($byTag = $request->getParameter('by_tag')) { $q->where('duplicate_tags_for_search LIKE ?', '%' . $byTag . '%'); } $this->pageByParentSlug($this->doc->slug, null, 'created_at desc', $q); }
/apps/frontend/modules/ullCms/templates/showExample.php:
<div id="example_tags"> <span class="example_filtertext">Tags:</span> <?php include_partial('ullCms/tagList', array( 'link_replacement' => '@ull_cms_show?slug=example&by_tag=%tag%', 'show_all_tag' => true, 'use_content_blocks' => true, )) ?> </div> <div id="example_entries"> <?php foreach ($docs as $currentDoc): ?> <?php $currentDoc->refreshRelated('Translation') ?> <div class="example_entry"> <h2> <?php include_component('ullCms', 'editLink', array('doc' => $currentDoc)) ?> <?php include_component('ullCms', 'deleteLink', array('doc' => $currentDoc)) ?> <?php echo $currentDoc->title ?> </h2> <?php echo $currentDoc->body ?> </div> <?php endforeach ?> <?php if (!count($docs)): ?> <?php echo __('No results found', null, 'common') ?>. <?php endif ?> <?php if (isset($pager)): ?> <?php include_partial('ullTableTool/ullPagerBottom', array('pager' => $pager)); ?> <?php endif ?> </div>
.