Usage example:
{phocagallery view=tag|tagname=Cersei|limitstart=0|limitcount=5|detail=1|displayname=1|displaydetail=1|displaydownload=1}
The "categoryid" switch is optional, but will limit the tag search to a category, but I wanted to search through ALL of my categories and subcategories for anything tagged.
(Line numbers are approximate because I did insert additional commenting)
INSERT Line 125:
Code: Select all
$tag_name = $paramsC->get( 'tag_name', '');
Code: Select all
else if($values[0]=='tagname') {$tag_name = $values[1];}
Code: Select all
if (($view == 'category') || ($view == 'tag')) {
Code: Select all
if ($view == 'category') {
$query = 'SELECT cc.id, cc.alias as catalias, a.id, a.catid, a.title, a.alias, a.filename, a.description, a.extm, a.exts, a.extw, a.exth, a.extid, a.extl, a.exto,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as catslug, '
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug'
. ' FROM #__phocagallery_categories AS cc'
. ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id'
. ' WHERE a.catid = '.(int) $catid
. ' AND a.published = 1'
. ' AND a.approved = 1'
. ' AND cc.published = 1'
. ' AND cc.approved = 1'
. $where
. $imageOrdering
. $limit;
} elseif ($view == 'tag') {
if ($catid > 0 ) {
$where = $where . ' AND a.catid = '.(int) $catid;
}
$query = 'SELECT cc.id, cc.alias as catalias, a.id, a.catid, a.title, a.alias, a.filename, a.description, a.extm, a.exts, a.extw, a.exth, a.extid, a.extl, a.exto,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as catslug, '
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug'
. ' FROM #__phocagallery_categories AS cc'
. ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id'
. ' INNER JOIN #__phocagallery_tags_ref as tr ON a.id = tr.imgid'
. ' INNER JOIN #__phocagallery_tags as t ON t.id = tr.tagid'
. ' WHERE t.title LIKE \'' . $tag_name . '\''
. ' AND a.published = 1'
. ' AND a.approved = 1'
. ' AND cc.published = 1'
. ' AND cc.approved = 1'
. ' AND t.published = 1'
. $where
. $imageOrdering
. $limit;
}