Force Item ID not working

  • string
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 2 months ago #2162 by string
Force Item ID not working was created by string
I am displaying cp tags inside articles using {cptag} fucntion. I have set force ID in the plugin settings (via Content - Custom Properties Tags Plugin ). When one clicks on one of these tags in an article a list of articles belonging to this tag appears in the search resluts, this view/page appears in the correct Item Id but when I click on one of these articles in the search results page it goes to the incorrect item ID, by default the home page. How can I fix this?

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #2165 by andrea_4g
Replied by andrea_4g on topic Force Item ID not working

... but when I click on one of these articles in the search results page it goes to the incorrect item ID, by default the home page


The *article* Menu Item Id doesn't depend on Custom Properties (unlike CP Tags Menu Item Ids).

We can distinguish 2 cases:
== SEF is OFF ==
The article Url will look like:
index.php?option=com_content&view=article&id=<art.nr>:<art.slug>&catid=<catid>&Itemid=<a-menu-item-id>

Joomla is able to determine which extension will have to handle the request (i.e. com_content) and will forward the parameters to it (view=article, id=...).
Joomla will then read the Itemid parameter, to know which menu item is going to be set as active and which modules need to be displayed.

If you force an Item Id of your choice, it will work.

In fact, if you set parameter 'Use Itemid' = 'Current page', in main Custom Properties options, you'll see that the articles of the result list will open in the very same page.
I must stress that this only work if SEF is off.

== SEF is ON ==
The same article's Url will look like like:
<menu-item-alias>/<cat-id>->category-slug>/<art-id>-<art-alias>

When Joomla receives such request, it will first match /menu-item-alias/ against the table of actual menu aliases.
When a match is found, it then gathers the params linked to it from the menu item table (i.e. option=com_content&view=article&...) and also the menu item id to attach the modules too.

If you tweak the Menu Item id, you break the SEF encoding and decoding mechanism and you likely end up with a 404 page.
For instance, *if* the menu item is not of 'com_content' type, the wrong extension is invoked and the additional url parameters are forwarded to it, therefore causing a malfunction.

== Conclusions ==
- You don't want to alter Menu Item Ids when SEF is on
- You need to let Joomla SEF engine find out and assign the appropriate Menu Item Ids

== Suggestion ==
Because Menu Item Ids for articles depends by actual menu items pointing to them (or to their parent categories), you might want to create one or more menu items pointing to your articles, so that you have a reliable way to assign modules to them. Hidden Menu Items work too.
The following user(s) said Thank You: string

Please Log in or Create an account to join the conversation.

  • string
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 2 months ago #2181 by string
Replied by string on topic Force Item ID not working
Hi Thanks for all your help.
It makes alot of sense. Hidden menus work like magic!

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago - 8 years 1 month ago #2409 by kuantan
Replied by kuantan on topic Force Item ID not working
Thanks, I think I am about to solve my problem!

But where in Joomla can I set:
set parameter 'Use Itemid' = 'Current page', in main Custom Properties options

Appreciate your help....

UPDATE:

Sorry, obviously this a feature of your "Custom Properties 3 for Joomla 3.x". So I presume there is no way to do this in default Joomla 3.x.
I am using gantry5 template styles, so I presume that(using your extension) a category list of articles will open the article in the same template style as the page that displays the category list, if I set 'Use Itemid' = 'Current page' (with sef==off). Correct?
Last edit: 8 years 1 month ago by kuantan.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #2410 by andrea_4g
Replied by andrea_4g on topic Force Item ID not working
Correct.
Regardless of the template you are using.

Please Log in or Create an account to join the conversation.

Time to create page: 0.170 seconds