PATCH: Link to section/category

Phoca Download - download manager
jisse
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 12 Jan 2009, 13:27

PATCH: Link to section/category

Post by jisse »

Hi Jan,

Because I wanted it myself, I have extended the component to allow a Menu-Item to point to a PhocaDownload section or category. The patch is attached to this post.

Hope you can include it in the next version!

Thanx for your work!
Jisse Reitsma
Jira ICT founder
SimpleLists developer
busy person
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PATCH: Link to section/category

Post by Jan »

Great, thank you, did you check the Itemid problem (settings) when user goes through the level (from category to section to sections) and from modules links (modules links get sections itemid, but if there is no sections view but only category view, the settings will be not from category view if user click on section link in module) while SEF is enabled?

Thank you, Jan
If you find Phoca extensions useful, please support the project
jisse
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 12 Jan 2009, 13:27

Re: PATCH: Link to section/category

Post by jisse »

Hi Jan,

I saw a post mentioning this. No, I have not tested this setup but it sounds like the Itemid is somehow lost? I'll give it a try as soon as I have some time (perhaps this weekend) and will let you know.
Jisse Reitsma
Jira ICT founder
SimpleLists developer
busy person
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PATCH: Link to section/category

Post by Jan »

Hi, the itemid and settings of site are bind to menu link and every link you will create in component needs to find some itemid... the problem is if you have .e.g. two menu links with different itemid... e.g. you have itemid for category view but you have possibility to go back to section (but the section needs some itemid too and cannot get itemid of category :-( so the itemid of sections menu link need to be found in database - after this the problem is solved... but what if user have no link to sections :-( ... this is the big problem in Joomla! and menu links :-(

Jan
If you find Phoca extensions useful, please support the project
jisse
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 12 Jan 2009, 13:27

Re: PATCH: Link to section/category

Post by jisse »

Hi Jan,

Yep, I know. Itemids and Joomla! are a never ending story - and they really cause problems when turning on SEF. I've been struggling with it before, but in the end all the work can be done in "router.php". I saw in the PhocaDownloads code that the Itemid is sometimes set when building a route (JRoute::_()). That's not neccessary. If all URLs are built in the same order, the Joomla! router should (!) be smart enough to add the appropriate Itemid.

Attached is a patch for 3 files. Mainly it concerns the "router.php" file, which before only had good support for "view=section", but now as well "view=category" and "view=sections". The category-part was already there, but there was an old identifier "catid" (which is now just "id"). Also I turned around the logic: For every query, it tries to match a menu-item even when there already is an Itemid.

The cool result is that if you have multiple menu-items pointing to PhocaDownloads, it will automatically use these menu-items when creating internal links as well. I've used this on http://opensource.jira.nl/downloads On the left you can see a plain menu but built with PhocaDownload-menu-items (sections/section/category). When navigating within PhocaDownloads, the active menu-item in the menu changes as well.

So far so good. What you mentioned as a problem as well, was that if you have a menu-item pointing to a category, but NO menu-item pointing to a "section" or "sections", that it fails as well. I dunt know if my patch solves this.

My other two patch-files are cosmetic. I've hacked some echo-code to plain HTML, removed some manual additions of the Itemid (which is not needed with JRoute::_()) and added a "No items found" message to a category-page.
Jisse Reitsma
Jira ICT founder
SimpleLists developer
busy person
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PATCH: Link to section/category

Post by Jan »

ok, one question ... did you change the version 1.0.5 or 1.0.6 ?

Jan
If you find Phoca extensions useful, please support the project
jisse
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 12 Jan 2009, 13:27

Re: PATCH: Link to section/category

Post by jisse »

Whoops, 1.0.5. Does this mean you already fixed this? Well, what the heck - it works for me.
Jisse Reitsma
Jira ICT founder
SimpleLists developer
busy person
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PATCH: Link to section/category

Post by Jan »

Hi, no, in 1.0.6 there is no this solution implemented but I need to know which files were edited by you because there are some changes between 1.0.5 and 1.0.6

Jan
If you find Phoca extensions useful, please support the project
jisse
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 12 Jan 2009, 13:27

Re: PATCH: Link to section/category

Post by jisse »

OK, so the "router.php" file is completely refactored. The others things about HTML/PHP, stripping the Itemid, and adding a "No items" text are very simple, and you have to make the choice wheather those additions are useful or not. :)
Jisse Reitsma
Jira ICT founder
SimpleLists developer
busy person
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PATCH: Link to section/category

Post by Jan »

Thank your, what you mean wit this:
stripping the Itemid, and adding a "No items" text are very simple
?
If you find Phoca extensions useful, please support the project
Post Reply