Page 1 of 2
Other menu options
Posted: 24 Mar 2009, 15:06
by lcdservices
It would be great if some additional menu options were created for phoca download. Specifically the ability to set a menu item to a specific section or specific category.
Re: Other menu options
Posted: 30 Mar 2009, 14:53
by Jan
Hi, creating menu links to other Phoca Download parts is very easy (e.g. to Categories, Files) but what is not easy, is to coordinate Itemids of these created menu links if users are using SEF in Joomla! because links rendered in every Joomla! component get no information about which Itemid they should use. So if there is a link in some component, the link has no information about the Itemid (and in fact it cannot get it from database too, becasue there can be more entries, etc, e.g.)
So there is problem with Itemid to create different menu options
Jan
Re: Other menu options
Posted: 30 Mar 2009, 15:17
by lcdservices
Right, now, there is just a single option for a menu item using Phoca Download -- which means you can only have an ItemId assigned to the main Phoca page.
Yes, it's easy to create menu links to other pages by first creating a main component menu item, navigating to the specific page (a category for example), and then creating an external url menu item link to that page. But as you correctly state, that does not allow you to have an automatically assigned itemid, and therefore not control module placement, etc.
Which is why the component needs suboptions for the menu items -- so that you can create a true component link to a select category, etc. and have the itemid built.
Re: Other menu options
Posted: 12 Apr 2009, 20:47
by codejunkie
I've successful added an option to add a menu link to an individual file, or an individual category, or an individual section. Works great. The metadata.xml and default.xml file of each needed modification. I also needed to create three element files to populate a parameter list of the particular items.
The language files also need to be edited. I have included the strings to include in the language file.
You can see and use all of this (may still needing some tweaking) from the included attachment. If you have any problems, I'll see if I can figure it out.
Edit: Attachment deleted. See
this post for link to working file.
Re: Other menu options
Posted: 15 Apr 2009, 16:12
by Jan
Hi, please let me know how did you solve the SEF problem (going through the tree- sections <-> categories <-> document if there are different itemid)
So it can be implemented in some next version.
Jan
Re: Other menu options
Posted: 15 Apr 2009, 16:22
by codejunkie
When you create a menu item, the id in the database for that menu item is the ItemID you need for the modules to load properly on each page. With this patch, the admin is allowed to create that menu item, thus allowing it to have an ItemID to reference. But the menu item still needs to be created.
If you do not create the menu item for reference, then your component (com_phocadownload) will need to query the parent item (file -> category -> section) to see if a menu item has been made and then maybe default to the default main menu item.
You might think about creating a hidden menu (one with an unpublished menu module) for the sections / categories / files for future reference. Then again, it might become too much for a site admin to handle as you would need to make sure modules were assigned to the appropriate menu items.
Re: Other menu options
Posted: 15 Apr 2009, 17:25
by Jan
there is still problem, if you will create two menus (e.g. to sections and to file) then you have 2 Itemids in your system
you can get it from the database, like I do it in Phoca Gallery:
Code: Select all
// -------------------------------------------------------------------- SEF PROBLEM
// Is there an Itemid for category
$items = $menu->getItems('link', 'index.php?option=com_phocagallery&view=category&id='.$valueImages->id);
$itemscat= $menu->getItems('link', 'index.php?option=com_phocagallery&view=categories');
if(isset($itemscat[0]))
{
$itemid = $itemscat[0]->id;
//No JRoute now
$siteLink ='index.php?option=com_phocagallery&view=detail&catid='. $valueImages->catslug .'&id='. $valueImages->slug .'&Itemid='.$itemid . '&tmpl=component&detail='.$tmpl['detailwindow'].'&buttons='.$detail_buttons;
}
else if(isset($items[0]))
{
$itemid = $items[0]->id;
//No JRoute now
$siteLink = 'index.php?option=com_phocagallery&view=detail&catid='. $valueImages->catslug .'&id='. $valueImages->slug .'&Itemid='.$itemid . '&tmpl=component&detail='.$tmpl['detailwindow'].'&buttons='.$detail_buttons ;
}
else
{
$itemid = 0;
//No JRoute now
$siteLink = 'index.php?option=com_phocagallery&view=detail&catid='. $valueImages->catslug .'&id='. $valueImages->slug . '&tmpl=component&detail='.$tmpl['detailwindow'].'&buttons='.$detail_buttons ;
}
// ---------------------------------------------------------------------------------
but this brings more problems than using only one menu item (link to sections) and then copying the menu link to category, section or file and add it into the system as "external link"
So it is easier to do a menu link to sections (get an itemid) and go through the tree (sections - section - category - file), copy this link and add it into the menu link as "external link" ... then the sections itemid will be used and it means no problems in modules, plugins and in component links which are linking throught the tree
Jan
Re: Other menu options
Posted: 06 May 2009, 05:56
by codejunkie
Jan,
I'm still thinking on the SEF issue. I haven't had the time to code up a solution, but I have ad an idea.
In com_phocadownload, create a new function to return the item_id of a file/category/section/sections. This function should require the type of view link (file/category/section/sections) and default to sections. Another variable to the function would be the item id (not menu item id) as assigned to the item.
The function should query "#__menu" for a list of menu links which are filtered on the "%com_phocadownload%" keyword in the "link" field. The fields to query should be `id`, `link` with an optional listing of the `name` and / or `alias`. You will need to parse each link in each row to find out if the type of view and the item number matches the assigned values. If the result is true, return the item_id for that item, if it does not, run the function again with the next available menu type.
Of course, you need to cache the return values. You might break this function into more than one function to accomplish what we need.
Re: Other menu options
Posted: 06 May 2009, 23:32
by Jan
Hi, as links are created by Joomla! methods, this needs to be solved in whole Joomla!
It is the problem of all parts Joomla! which are not menu link. Every link in Joomla! which is not created by menu link can be possible problem for SEF because SEF is made only from menu links and if you need (as it is normal needed in many extensions) go through some different view (which can get own links) then you cannot solve it, because you never know which itemid the link can get and if you find it in database (database of menu links) and there will be more links to e.g. come category view, you don't know (I mean the script don't know) which ID is the right Id

Re: Other menu options
Posted: 07 May 2009, 03:26
by lcdservices
I think you're missing the point -- the original request (mine) in this thread was to create more menu options. Yes, we understand how ItemID works -- which is why it would be useful to have some additional menu items that address very core functions, like displaying a single category.