Phoca Gallery Plugin - Tags

Phoca Gallery plugins - plugins for Phoca Gallery extension
lucas3001
Phoca Member
Phoca Member
Posts: 43
Joined: 10 Feb 2015, 15:44

Re: Phoca Gallery Plugin - Tags

Post by lucas3001 »

Hello eveyone!

I'm trying to implement this function, but i'm a bit confused.

Is the phocagallery.php file the one located in /plugins/content/phocagallery ?

If so, i can't find where to edit the line 935:

Code: Select all

if (($view == 'category') || ($view == 'tag')) { 
since you say the numbers could be not the same, would you please indicate what is just before and after the code to be inserted/edited?

thank you so much

regards
Lucas
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Gallery Plugin - Tags

Post by Jan »

Hi, there is:
if (($view == 'category') and you should change it to the code mentioned above.

Jan
If you find Phoca extensions useful, please support the project
lucas3001
Phoca Member
Phoca Member
Posts: 43
Joined: 10 Feb 2015, 15:44

Re: Phoca Gallery Plugin - Tags

Post by lucas3001 »

Hello!
thank you for reply.
first of all, i would explicitely say the file is in the /main/plugins/content/phocagallery folder.
I am not so new to script editing, so i did serach for the required expression

Code: Select all

if (($view == 'category') 
without finding at all :x ...
but i'm rather new to php to understand the double round brackets at the beginning are the final result of editing :D
so for people not understanding php, like me, i'd like to add a few hint to obtain the result... a sort of guide for very dummies :D

first

Code: Select all

    $tag_name = $paramsC->get( 'tag_name', ''); 
this is just a variable declaration, and can be inserted almost everywhere between the
// Plugin variables
and
// CSS
section.

second

Code: Select all

    else if($values[0]=='tagname')    {$tag_name = $values[1];} 
is the addiction of a case in the
// Get plugin parameters from article
section.

third
In order to edit the line TO

Code: Select all

if (($view == 'category') || ($view == 'tag')) { 
one should understand that originally it is JUST

Code: Select all

if ($view == 'category')  { 
where we add an OR function to search in database to display images.
indeed the line is , for me at least, found in the section
//-----------------------
// DISPLAYING OF IMAGES
//-----------------------
once edited the line to what suggested by sachiel you can go to the last part
lucas3001
Phoca Member
Phoca Member
Posts: 43
Joined: 10 Feb 2015, 15:44

Re: Phoca Gallery Plugin - Tags

Post by lucas3001 »

....continuing from previous message.....

fourth
the actual query. Few row below the line at third point there is the section for the query.
You should Find exactly these lines:

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;
}
So you have to add the part related to the Tag parameter. You can just overwrite these lines with the code suggested by sachiel or just add

Code: Select all

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;
} 
leaving all the rest unchanged.

Then I would strongly reccommend, aspecially for beginners, like me, to save the original php file somewhere because, if something goes wrong in editing the file, then the site goes to BLANK.... then baking up the original file you can restore it.

Hoping this could help, i thank very much sachiel for the feature and Jan for the reply

cheers
Lucas
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Gallery Plugin - Tags

Post by Jan »

Hi, thank you for this guide.

Jan
If you find Phoca extensions useful, please support the project
lucas3001
Phoca Member
Phoca Member
Posts: 43
Joined: 10 Feb 2015, 15:44

Re: Phoca Gallery Plugin - Tags

Post by lucas3001 »

I resume this post to say i've found a small bud, or maybe is a missing,

I have sucesfully used this method to create "trasversal" group of images through different categories, and if I display them with the switch image feature it is working well.
Let's say applying the tag1 I see image1 from cat1, image1 from cat2 and image3 from cat4.

However, if I click on images, and the detail window BOXPLUS opens, trying to move back and forth with the direction buttons I dont display the sequece
image1-cat1, image1-cat2 and image3-cat4,
but if i start from
image1-cat1
and press ">>" button I obtain Image2 of cat1, and not image1 cat 2.

Do anyone have an idea of how to fix this issue?
The strange is if I use detail=5 (Highslide) it is ok
but even if detail=10! (and this also reply to another post of mine)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Gallery Plugin - Tags

Post by Jan »

Hi, can you paste screenshot to be sure what you exactly means?

Thank you, Jan
If you find Phoca extensions useful, please support the project
lucas3001
Phoca Member
Phoca Member
Posts: 43
Joined: 10 Feb 2015, 15:44

Re: Phoca Gallery Plugin - Tags

Post by lucas3001 »

Jan wrote:Hi, can you paste screenshot to be sure what you exactly means?

Thank you, Jan
Hi I think you've answered on this other post
Jan wrote:Hi, no you don't need to install anything.

In Popup method, you can mostly seclect between two methods, e.g.:

boxplus (image method)
boxplus (iframe method)

Image method display only images which are displayed on current page
iframe method can navigate to images in whole category

as both are different featuers - image method only displays image in popup, iframe displays whole new page (where you can display html page - in this case image with navigation to other pages - to pages with other images in the same category
)

Jan
indeed I now switched to
detail=10 in the articles with tag view

and to

boxplus(image only) in the detail view for category

and now I've solved the problem :)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Gallery Plugin - Tags

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
namford
Phoca Member
Phoca Member
Posts: 22
Joined: 25 Jun 2015, 18:11

Re: Phoca Gallery Plugin - Tags

Post by namford »

Hi Jan

Phocagallery is a very cool componet, especially given that its free! But I would really like to make proper use of the tags in phoca. I can see comments and questions about tags going back two or more years. Has there been any progress here - i.e. can tags in phoca actually be useful yet? I want to create a page link that will return all images with a specific tag. Please can you advise how I can do this?

Thank you
Natalie
Post Reply