Frontend\Modules\Tags\Engine\Model::getAll PHP Method

getAll() public static method

Fetch the list of all tags, ordered by their occurrence
public static getAll ( ) : array
return array
    public static function getAll()
    {
        return (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT t.tag AS name, t.url, t.number
             FROM tags AS t
             WHERE t.language = ? AND t.number > 0
             ORDER BY t.tag', array(LANGUAGE));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Parse
  */
 private function parse()
 {
     // get categories
     $tags = FrontendTagsModel::getAll();
     // we just need the 10 first items
     $tags = array_slice($tags, 0, 10);
     // build link
     $link = FrontendNavigation::getURLForBlock('Tags', 'Detail');
     // any tags?
     if (!empty($tags)) {
         // loop and reset url
         foreach ($tags as &$row) {
             $row['url'] = $link . '/' . $row['url'];
         }
     }
     // assign comments
     $this->tpl->assign('widgetTagsTagCloud', $tags);
 }
All Usage Examples Of Frontend\Modules\Tags\Engine\Model::getAll