Hi,
In Phoca Gallery there are tags attached to images, but the tags are not clickable, there is no possibility for filtering images by tags.
Is there a solution for this problem?
Thank you.
Filter images by tags
- Jan
- Phoca Hero
- Posts: 48714
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Filter images by tags
Hi, there is no filtering in Phoca Gallery. For such purposes, maybe Phoca Cart can be used as it has advanced filtering methods:
https://www.phoca.cz/stockphoto/
Jan
https://www.phoca.cz/stockphoto/
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 26
- Joined: 14 Jun 2016, 14:28
Re: Filter images by tags
Well, it's quite interesting because in fact THERE IS tag filtering option in Phoca Gallery. Everything is in the code but it was not fully implemented. If you compose this url:
index.php?option=com_phocagallery&view=category&tagid=7
it will filter the images by the tag with ID number 7. So the component handles the tag IDs, but there is no tag list view implemented.
In this file: administrator\components\com_phocagallery\libraries\phocagallery\tag\tag.php
the display of the tags can be modified in order to display clickable linked tags.
Line 125:
if ($tl == 0) {
$o .= $v->title;
} else if ($tl == 1) {
if ($v->link_ext != '') {
$o .= '<a href="'.$v->link_ext.'" '.$targetO.'>'.$v->title.'</a>';
} else {
$o .= $v->title;
}
The above code should be changed to this:
if ($tl == 0) {
// $o .= $v->title;
$link = 'index.php?option=com_phocagallery&view=category&id=tag&tagid='.(int)$v->id;
$targetA = $popupLink ? ['target' => '_parent'] : [];
$o .= JHtml::_('link', $link, $v->title, $targetA);
} else if ($tl == 1) {
if ($v->link_ext != '') {
$o .= '<a href="'.$v->link_ext.'" '.$targetO.'>'.$v->title.'</a>';
} else {
$o .= $v->title;
}
So the tags are now linked, and the filtering is OK, but there is no router, and no tag title on the tag list page (like a category title on a category page).
What do you think of this little modification? Is it worth implementing it in the code with router and title, and release it in the next version of Phoca Gallery?
index.php?option=com_phocagallery&view=category&tagid=7
it will filter the images by the tag with ID number 7. So the component handles the tag IDs, but there is no tag list view implemented.
In this file: administrator\components\com_phocagallery\libraries\phocagallery\tag\tag.php
the display of the tags can be modified in order to display clickable linked tags.
Line 125:
if ($tl == 0) {
$o .= $v->title;
} else if ($tl == 1) {
if ($v->link_ext != '') {
$o .= '<a href="'.$v->link_ext.'" '.$targetO.'>'.$v->title.'</a>';
} else {
$o .= $v->title;
}
The above code should be changed to this:
if ($tl == 0) {
// $o .= $v->title;
$link = 'index.php?option=com_phocagallery&view=category&id=tag&tagid='.(int)$v->id;
$targetA = $popupLink ? ['target' => '_parent'] : [];
$o .= JHtml::_('link', $link, $v->title, $targetA);
} else if ($tl == 1) {
if ($v->link_ext != '') {
$o .= '<a href="'.$v->link_ext.'" '.$targetO.'>'.$v->title.'</a>';
} else {
$o .= $v->title;
}
So the tags are now linked, and the filtering is OK, but there is no router, and no tag title on the tag list page (like a category title on a category page).
What do you think of this little modification? Is it worth implementing it in the code with router and title, and release it in the next version of Phoca Gallery?
- Jan
- Phoca Hero
- Posts: 48714
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Filter images by tags
Hi, I don't understand the code.
If it is set in parameters that tags should not have any link (tl == 0), why the code creates a link?
Tags are a part of category view, so they are linked in (tl == 2).
Jan
If it is set in parameters that tags should not have any link (tl == 0), why the code creates a link?
Tags are a part of category view, so they are linked in (tl == 2).
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 26
- Joined: 14 Jun 2016, 14:28
Re: Filter images by tags
Ok, sorry, I overlooked this option in the parameters somehow. The tags can be linked with search outcome. That's great.
What is missing is the router and the tag title on the tag list page.
When a user clicks on a tag (in search outcome mode), a title on the tag list page should indicate the tag filtering, and a SEF url generated by the router would also be useful.
Any chance you could add these features to your code?
What is missing is the router and the tag title on the tag list page.
When a user clicks on a tag (in search outcome mode), a title on the tag list page should indicate the tag filtering, and a SEF url generated by the router would also be useful.
Any chance you could add these features to your code?
- Jan
- Phoca Hero
- Posts: 48714
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Filter images by tags
Hi, the link is generated by SEF:
or:
See: administrator/components/com_phocagallery/libraries/phocagallery/path/route.php
method: getCategoryRouteByTag
Jan
Code: Select all
$link = PhocaGalleryRoute::getCategoryRoute($category->id, $category->alias);
Code: Select all
$link = PhocaGalleryRoute::getCategoryRouteByTag($v->id);
method: getCategoryRouteByTag
Jan
If you find Phoca extensions useful, please support the project