SEF Itemid

More
14 years 3 months ago #20179 by David
SEF Itemid was created by David
Hello,

I have a question about the route.php and sef.

Because in my website I have a category which all singer and band but I use the flexi mod for see the news items and populars items but in the link there isn't not the same Itemid so there isn't the same link.

For example :
In my principal category the link for the song alicia keys is : index.php?option=com_flexicontent&view=items&cid=144:alicia-keys&id=1709:alicia-keys-no-one&Itemid=2

But when I see in my home page where is the mod flexi I see this link : index.php?option=com_flexicontent&view=items&cid=144:alicia-keys&id=1709:alicia-keys-no-one&Itemid=1

My question is : Can I change the Itemid from the mod flexi for have the same url ? Thanks and sorry for my bad english ...

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

More
14 years 3 months ago #20180 by ggppdk
Replied by ggppdk on topic SEF Itemid
I had added a parameter to Universal FLEXIcontent module to force the use of a specific menu itemid.
Then i removed this parameter.

I was thinking that some times we want to have the same menu itemid for the links displayed by the module.

Is that what you ask, i mean you speak of the FLEXIcontent module?

Maybe my original thought was correct, that such a parameter would be useful / needed.


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
14 years 3 months ago #20183 by David
Replied by David on topic SEF Itemid
Yes sure, there is a good idea !

I use de Universal FLEXIcontent module

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

More
14 years 3 months ago #20184 by David
Replied by David on topic SEF Itemid
Sorry but I have a other question.

I created a other page where the visitor can see the new item in a category with blog template but I would too force de itemid for the links.

Because the iniatial itemid is 2 but I see 8 on the link ...

I thinks to modified in the template : "category_item" the line :
Code:
<?php if ($this->params->get('link_titles', 0)) : ?> [url=<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $items[$i]->categoryslug)); ?>]<?php echo $items[$i]->title; ?>[/url] <?php

But I don't have idea to force the itemid ...

I use this option to create a feed because I had found any others options ...

Thanks

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

More
14 years 3 months ago #20187 by ggppdk
Replied by ggppdk on topic SEF Itemid
function getItemRoute($id, $catid = 0, $Itemid = 0);
function getCategoryRoute($catid, $Itemid = 0);

Above are the signatures of the functions that create the FLEXIcontent links to items and to categories, which are then converted to SEF link by passing it through JRoute::_(...)

// Create an FC item link and then convert to SEF link
JRoute::_( FlexicontentHelperRoute::getItemRoute($id, $catid, $Itemid) );

// Create an FC category link and then convert to SEF link
JRoute::_( FlexicontentHelperRoute::getCategoryRoute($catid, $Itemid) );

As you can see in the above signatures there is a 3rd parameter called $Itemid. This parameter can be used to force a specific menu itemid. So there you have it.

Also note that normally/usually we do not set this 3rd parameter for getItemRoute(...).
In this case we let the function decide the "optimal" which is from high to low priority menu item that are:
1. MATCH menu itemid: FC item id + FC category id
2. MATCH menu itemid: FC item id
3. MATCH menu itemid: FC category id
4. MATCH menu itemid: the CURRENT menu itemid, if it points to FC
5. What the global configuration option suggests (e.g. a chosen in global configuration item id or no itemid at all)

As i said above you can override the above priority list and provide the menu itemid you want.

BUT THE PROPER way to do it would be to have a new common template parameter (or a new template specific parameter for blog template or whatever the name of the template is).

In short:
1. So add this parameter in category.xml of your template (e.g call it "Force Menu itemid for items")
2. Edit your category_items.php to use the new parameter , by retrieving the parameter and then using it a 3rd parameter in function getItemRoute()
3. Edit the categories you want and set the new parameter for every of them and save.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
14 years 3 months ago #20192 by David
Replied by David on topic SEF Itemid
Hello ggppdk,

Thank you for your explanation, I found the solution for the Flexi Mod and category.

For the Flexi Mod : I just add "$itemid=2" in the two variabel $link :

Ligne : 265
Code:
$lists[$ord]['featured'][$i]->link = Route::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->categoryslug, $itemid=2));

Ligne : 334
Code:
$lists[$ord]['standard'][$i]->link = Route::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->categoryslug, $itemid=2));

For the category :

I modifed in the category_items.php the ligne 95 :
Code:
[url=<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $items[$i]->categoryslug, $Itemid = 2)); ?>]<?php echo $items[$i]->title; ?>[/url]

Now all my links are OK.

Thanks

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

More
14 years 3 months ago #20193 by ggppdk
Replied by ggppdk on topic SEF Itemid
Yes, this is what i suggested but you did without parameter. So now your solution is hardcoded inside the PHP files for all categories.
(Now all categories are forced the same menu item id for their items)

What i suggested by the parameter is to all to have different forced menu item id per category and also by leaving the parameter blank we make it optional too.

Anyway your proposition makes sense and i will add this parameter to both category and module.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
14 years 1 month ago #21642 by Hyperion
Replied by Hyperion on topic SEF Itemid
Hi,

There's another way, if I may.

Sometimes mod_flexicontent (in homepage) does not place the right Itemid in the url. I have of to force this regulation by inspiring me of the code of ggppdk.

At first by modifying the file modules/mod_flexicontent/mod_flexicontent.xml
Code:
<param name="force_curr_itemid" type="radio" default="0" label="FLEXI_FORCE_CURR_MENU_ITEMID" description="FLEXI_FORCE_CURR_MENU_ITEMID_DESC"> <option value="0">FLEXI_NO</option> <option value="1">FLEXI_YES</option> </param> <param name="forced_itemid" type="text" default="" size="3" label="FLEXI_FORCED_ITEMID" description="FLEXI_FORCED_ITEMID_DESC" />
Two parameters: the one asking if we need to force Itemid and the other one, in case of positive answer, which Itemid must be forced.

Then the file modules/mod_flexicontent/helper.php
Code:
// Forced ItemID $force_curr_itemid = (int)$params->get('force_curr_itemid', 0); $forced_itemid = (int)$params->get('forced_itemid'); $final_itemid = ($force_curr_itemid) ? $forced_itemid : 0;
And
Code:
$lists[$ord]['featured'][$i]->link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->categoryslug, $final_itemid));
Code:
$lists[$ord]['standard'][$i]->link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->categoryslug, $final_itemid));

In this way I am not dependent any more on the active itemid... the module can be placed somewhere and a pointer towards the other one with no problem at all... while keeping the regulations of the itemid of destination.

Regards

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

More
14 years 1 month ago #21643 by ggppdk
Replied by ggppdk on topic SEF Itemid
yes i was thinking to re-enabling the parameter to force a specific menu item id for the module, if you do not force a specific then the FLEXIcontent routing will select the "closest" match.

I have opened an issue not to forget:
Options will be:
a. force specific
b. use current if pointing to FLEXIcontent
c. auto select best match

code.google.com/p/flexicontent/i ... ail?id=329

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save