Page 2 of 2
Re: Tree Module Dissapearing when clicked on
Posted: 14 Aug 2009, 02:16
by trespies
Hello, I'm new in the forum and in the use of Phoca Gallery.
On the other hand, excuse me, because mi english is very poor.
First, thank you very much for your great great component...
Now, about the problem presented in this post, I had the same problem, both with the tree and the menu module...
Although I know almost nothing of php, I were looking for the problem by the file mod_phocagallery_menu.php, and I found that it's lies in the line 182, that determines the route of link:
$link = JRoute::_('index.php?option=com_phocagallery&view=category&id='. $catid_slug .'&Itemid='.$itemId);
For some reason that I can't clarify (¿between lines 147-180, where "Create link (set Itemid)"?), when click on some element of the tree or menu, the variable $itemId doesn't receive correctly the numeric value itemId of the page where the module is, and, so, the menu disappears... (It's created other numeric itemId, where the module isn't recognized).
To correct the problem, I've made a very simple change in that line, getting the itemId trough a querystring, as follows:
$link = JRoute::_('index.php?option=com_phocagallery&view=category&id='. $catid_slug .'&Itemid='.$_GET['Itemid']);
In this way, the tree or module menu always remains in the page where you have placed it, when you click on their elements... You can, not only set the module in the pages that you want, without set their parameters to ALL... You can put it even in pages without phocagallery menuitem, where you want (but it break the logical route, that is to say, it's bad for breadcrumb and the architecture of information).
But, care: obviously, it only functions if SEO is disabled.
Well, I ignore if this solution is a silly thing... I ignore also if it can bring other problems of functionality (although I've checked all and it seems ok)... But what I know is that I've arrived here very late, with some months of delay... Sorry, I'm a newcomer.
Thanks,
Regards,
Nacho
Re: Tree Module Dissapearing when clicked on
Posted: 14 Aug 2009, 10:07
by vdneut
Thanks, this works also if SEO is enabled because the url with the $Itemid=... in it is converted by the Joomla! core SEO/SEF plugin. Thanks for that!
But...
I hope Jan will make the definitive solution since the workaround from Nacho does not respect existing menu items linked to phoca galery (sub)categories.
Re: Tree Module Dissapearing when clicked on
Posted: 14 Aug 2009, 13:50
by trespies
Thank you for your reply, Vdneut.
Excuse me, but I don't understand exactly what do you mean with "the workaround does not respect existing menu items linked to phoca galery (sub)categories".
Perhaps do you mean that, if I place a specific menu joomla to appear when click on some specific subcategorie of tree or menu module, it doesn't appear?
In any case, it's a good notice for me that the querystring method is valid also with SEO activate, since, although I'm working actually without SEO, my intention is activate it when I finish the work (only if all it funtions properly, logically).
A positive thing of the querystring method is that you don't need to have any joomla menuitem linked to any phocagallery content option, the tree or menu module will work equally. If you wish it, you can see example in
http://mundojoomla.org/index.php?option ... &Itemid=27 (sorry, the project is in development, on the basis of Demo Joomla Site with Ja Purity template, and... I'm a newcomer in joomla).
In the same way, I would be very interested in any example that can help me for future developments...
Thanks,
Regards
Re: Tree Module Dissapearing when clicked on
Posted: 20 Aug 2009, 21:35
by vdneut
Excuse me, but I don't understand exactly what do you mean with "the workaround does not respect existing menu items linked to phoca galery (sub)categories".
Ok, I'll give it a try, but please be aware I'm not a Phoca expert!
Let's asume you have a menu item pointing to a specific Phoca gallery category. You can do this via the Joomla menu manager click on New and select the "Phoca Gallery Category Layout" option. After pressing Save, you have a new menu row with, lets say, ItemID = 20 (right most column in your menu overview).
The Phoca gallery tree module will create a tree having links (URL) to all Phoca categories. But when it create these URL's it searches the menu system for items that point to a Phoca gallery category. So, in the example it will find the menu with ItemID = 20 and therefore your URL will end with "&itemID=20".
When it does NOT find a menu entry pointing to the Phoca gallery it (should) use the current itemID (instead of 0).
This is exactly your solution, but it overwrites the itemID allways (also the 20 when it should not).
My suggestion for a quick workaround would be changing line 147 (approx.) to the following:
Code: Select all
if(isset($itemsCategory[0])) {
$itemId = $itemsCategory[0]->id;
$alias = $itemsCategory[0]->alias;
} else if(isset($itemsCategories[0])) {
$itemId = $itemsCategories[0]->id;
$alias = '';
} else {
// Replace this line:
// $itemId = 0;
// with this one...
$itemId = $_GET['Itemid'];
$alias = '';
}
I did not dive into it too deep, so this might not be the optimal fix. I hope the developer of the gallery will have a look at it to fix it in a propper way.
Is there a change that this is going to be fixed?
Re: Tree Module Dissapearing when clicked on
Posted: 23 Aug 2009, 10:54
by trespies
Hello, Vdneut, thanks for your reply.
If I understand you, then, after to change the original code lines for your lines, also will have to return the line:
Code: Select all
$link = JRoute::_('index.php?option=com_phocagallery&view=category&id='. $catid_slug .'&Itemid='.$_GET['Itemid']);
to the original:
Code: Select all
$link = JRoute::_('index.php?option=com_phocagallery&view=category&id='. $catid_slug .'&Itemid='.$itemId);
no?
Well, I'll prove your method...
Only a thing: in my case,
I don't have any menu item linked to Phoca Gallery (so, you have the possiblity of place tree or menu modules on pages with other contents; they will disappear when you click on some gallery of the tree).
Thanks, regards.
Nacho
Re: Tree Module Dissapearing when clicked on
Posted: 28 Sep 2009, 08:16
by vdneut
Hello trespies,
Yes, you’re right, you'll need to correct the $link back to it's original source as stated in your post.
I do not understand your last remark though. It seems a bit impossible what you describe, so probably I do not comprehend the situation.
Let's assume you have a page that shows the tree and this page has ItemId=30. You press somewhere in the tree and (with the fix in place) it should create the tree again on the new page with ItemId=30. If the tree was displayed in the first case, it should be displayed again since the ItemId did not change.
What am I missing here?
Re: Tree Module Dissapearing when clicked on
Posted: 28 Sep 2009, 17:27
by trespies
Hello, Vdneut.
Ok, thanks.
In my last remark, I refer that, in theory, you can't place a Phocagallery Menu/Tree Module if you don't have an item menu linking to Phocagallery Component; what I wanted to say is that, in my case, there isn't this link to any Phocagallery Component (although this Component have to be installed, logically). So in this way you can place where the Menu/Tree Module is, for example, an article with written or graphic presentation... and it will dissappear when you click on some elemment from Menu/Tree module (but the Menu/Tree Module will remain).
In any case, when I tested the replacement "Itemid='.$itemId" by "Itemid='.$_GET['Itemid']" with SEF mode + mod_rewrite actives, in my case the thing didn't work, and the anterior problem (Menu/Tre Module dissappears when click on...) returned to occur.
So, I made a little workaround for adapt the working of Menu/Tree Module to my SEF + mod_rewrite.
If you are interested, you can see the workaround in other topic titled
Working with Phocagallery Menu or Tree Module on SEO Mode, located in
viewtopic.php?f=15&t=5922.
But, as I recognize the start of the topic, and then adds the own developer, our Jan Pavelka Hero, my workaround is a poor solution... but, in my case, it works.
You can see this solution working in
http://mundojoomla.org/fotografia (spanish website) or in my test bench
http://ignacioiglesias.com/joomla/ (english).
Regards,
Nacho