SEF Itemid

More
12 years 5 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
12 years 5 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...

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

More
12 years 5 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
12 years 5 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
12 years 5 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...

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

More
12 years 5 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.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.303 seconds
Save
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