[SOLVED] non-SEF category / item urls that originate directly from menu items, do not add the category / item alias to the URL

More
10 years 4 months ago - 10 years 4 months ago #58972 by Ninjakitten
I really, really don't like having the numbers and '/category/' in my URLs. I don't want to swap having /category/ for having /item/, either. I can't afford to buy an extension to do SEF, and it doesn't look like there's a free one that can handle flexicontent.

It looks like this has come up many times before and you're dead set on having the URLs like that and not adding an option to lose the numbers and such, so I figured I'd give in and make hidden menu items for Every. Single. Category. to at least get the /category/ and number out of category URLs, but then I found that while the default links give a cid of ##:name (like 80:felix), making a flexicontent category menu item only gives you a cid of ## (like 80). This is a problem, because my work-around for displaying fields in the description area of category views uses the name portion of the cid, so losing that breaks the whole system.

I thought well, okay, fine, I'll find the category menu item type, clone it, and change where it has cid=## to cid=##:name. I found where the menu item type is defined. But... I can't seem to find where it actually creates the 'Link' when the category's chosen.

So, could you please tell me how I can make a menu item type that clones the one for category except using a link of "index.php?option=com_flexicontent&view=category&cid=80:felix" instead of "index.php?option=com_flexicontent&view=category&cid=80"? Or are there any free SEF components which actually work with Flexicontent? Some other way to do it I haven't thought of yet? I'd just do standard URL rewriting, except there's no way for me to know what numbers I'd have to add into the urls to make them work.

Overall I'm really liking this component, but this aspect is really driving me up a wall. Yes, it's a cosmetic issue, but that doesn't mean it doesn't matter.
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #58981 by ggppdk
Hello

about alias,
recently found and fixed a bug that category alias was not included

maybe it is the case that you mention
- you can test on a test server this build:
github.com/FLEXIcontent/flexicontent-cck/releases


-- 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!
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #58997 by Ninjakitten
I've been able to test this build, now, and sadly whatever the bug was, it apparently wasn't the problem I've got. Making a menu item to point to a category still creates a link like index.php?option=com_flexicontent&view=category&cid=80 instead of one like index.php?option=com_flexicontent&view=category&cid=80:felix.

Is there another way I can make it create the right link? Where is the link even created?
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #59000 by ggppdk
Hello

the fix i was talking about, is for category URLs that are not menu items

- for menu items you do not need the category-alias because the SEF url will only show the menu-item-alias
- joomla category links for category menu items are similar, they do not have the alias
e.g. the following is a menu item when SEF URLs are disabled
index.php?option=com_content&view=category&layout=blog&id=225&Itemid=1270&lang=en


-- 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!
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #59002 by Ninjakitten
No, for menu items I DO need the category alias, because as I said, that's what I used as the basis for my workaround to allow fields to work in the body of category pages. Without that, it breaks. I need the menu link to include the :name portion.

Please tell me where it's done, so I can fix it (for my purposes) myself. I've looked and failed to find it thus far. I don't want /category/ and I do NOT want the number showing, and the only way to fix that is apparently an SEF plugin I can't afford or using menu items, which is really an unreasonable amount of time and effort since I'll have to do it for every category, but it annoys me enough that I'm willing. But it's no good because the :name portion isn't in the menu's link and I can't force it to be, so it breaks my code.

All I'm really asking here is to know where the code that decides what the link to the category is is located, so that I can make myself a version that adds in the :name. Thanks.
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #59003 by ggppdk
Hello

adding alias will not be a security problem since it is always casted to int by the model
- but it will break the routing code that reads the menu items from DB, there are operators == that assume that the value is integer
- the alias in menu items, will not be updated if you edit and change the alias of the category

can you explain how you are using, and how it is related to fields ?

my work-around for displaying fields in the description area of category views uses the name portion of the cid


- 1. what do you do with the fields in relation to the category title alias ?
- 2. and why get the category alias this way ? if you have the category id, then you can get the category alias in simpler and -safer / more secure - way


-- 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!
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #59005 by Ninjakitten
I could deal with having to reset the menu items if I changed an alias, but breaking the routing code definitely seems like a deal-breaking kind of issue. Drat. Thank you for letting me know!

Basically, what I've done is create unpublished items which use normal fields to hold the data for the 'page' that each category is, and then a number of 'display' plugins which are in the category's template, up in the area defined by category_category; obviously I've set up custom templates to create a few spots up there as well. The display plugins use the second half of the cid to match the category alias with the item of type 'data' with the same alias, and pull the information out of that. It works fairly nicely, for my purposes. (Also, because of this, changing a category alias is rather unlikely and would break more than the menu item if I did it, so that's why that part doesn't concern me so much. ;) )

I suppose the safest way would be to rewrite all the display plugins to get the category alias from the category number, since that will always be there and I can't think how it'd break anything else. I originally grabbed the alias from the cid because it avoided an extra db query, but is there a better way?
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #59006 by ggppdk
Hello

getting a single category row or (several category rows with a single query)
- by using ID or IDs
- and without order clause in the query
- and on category table that has < 2000 categories

will / should cost almost minimal almost zero time


-- 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!
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #59007 by ggppdk
Also if you do not need falang to translate the alias

you can use an object created by flexicontent system plugin (which is retrieved from Joomla cache):
Code:
global $globalcats; $jinput = JFactory::getApplication()->input; $cid = (int) $jinput->get('cid', '', 'int'); $cat = isset($globalcats[$cid]) ? $globalcats[$cid] : false; if ($cat) echo "Category slug is: ".$cat->slug;


-- 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!
Last edit: 10 years 4 months ago by ggppdk.

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

More
10 years 4 months ago - 10 years 4 months ago #59008 by Ninjakitten
I don't need translation on this project, so I'll give that second option a go. Thanks very much!
Last edit: 10 years 4 months ago by ggppdk.

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