Hi all,
I am trying to figure out the Seblod SEF Router. What I would like to do is build an SEF URL, based on the following properties: itemid, catid, id, (view=article). I would like the generated URL to be the same as the one Seblod SEF generated automatically (I have set Seblod SEF Router setting to 'parent/alias').
Is there any easy way to use the Seblod Router class to build a SEF URL based on the values that I have? What I have done is created a function under the content type/item view to show previous/next buttons. I use a DB query to find the previous and next article, and retrieve it's associated information.
This works fine, but the URL rewriting does not.
When I vardump the $query array (Seblod router.php), I get the following (one example):
array(5) { ["view"]=> string(7) "article" ["catid"]=> string(25) "<cat_name>" ["id"]=> string(31) "<id>:<article-alias>" ["Itemid"]=> string(4) "<item-id>" ["option"]=> string(7) "com_cck" }
Seblod will generate a link such as this (from the above):
/<category-parent>/<category>/<article-alias>.html
If I use JRoute::_ function, the URL generated by:
JRoute::_('index.php?option=com_content&view=article&id='.$id.':'.$alias.'&catid='.$category.'&Itemid='.$menuitem)
Will result in:
/component/content/article/<parent-catid>-<parent-cat-name>/<cat-alias>/<content-id>-<content-alias>.html?Itemid=101
This does 'work', but it changes itemid to be 101 (even though itemid is passed to JRoute, I have the menu item!), but also meta attributes (<title> tag) be that of the homepage. The most obvious problem is it very different to what Seblod generates.
The only way for this to work is to not use SEF urls for this request at all, which I would like to avoid doing.
I've spent the last while now trying to figure out Seblods SEF routing code but to no avail. Am I missing something obvious here? Any help is appreciated :)
Thanks,
Nick