Adding information to a pretty URL

Permalink 1 user found helpful
I have a block I am working on that has two different "modes"...kinda like a preview/details thing. Well, currently the only way for me to tell it which mode to render in is using a URL parameter...something likewww.www.site.com/page?detail=item-one,... where "item-one" is the item I'm viewing the detail on.

What I would like to do is display that aswww.www.site.com/page/item-one.... However, I do not want to have to create a whole new page call item-one below that page. So, essentiallyhttp://www.site.com/page andhttp://www.site.com/page/item-one will take you to the same page. I will just add some code to the block controller to parse the URL and render accordingly.

Any thoughts as to how this could be accomplished?

jgarcia
 
jgarcia replied on at Permalink Reply
jgarcia
Here's an additional thought on this: in theory, this could be done by creating an alias of a page directly below itself. However, the problem with that is that because it's an alias, they apparently have to have the same page path too. I could potentially create an alias and this just update the path path for the alias, but that seems more like hacking the system and I would prefer to do this in a non-hacky way if possible...
ScottC replied on at Permalink Reply
ScottC
you'd want to override the concrete5 library controller(the main one) specifically in regards to where it gives up on the 404 stuff.

you need to supress that via the given parameters and sidestep the whole reflection method arg checking it does right now.
jgarcia replied on at Permalink Reply
jgarcia
I've been able to execute the following code to accomplish the purpose I'm looking for (create a page alias of itself, below itself, with a different handle):
<?php 
$cID = 100;
$c = Page::getByID($cID);
$ncID = $c->addCollectionAlias($c);
$nc = Page::getByID($ncID);
$nc->update(array('cHandle' => 'details','cName' => 'Details'));
?>

The only problem is that when i specify cName (the page name), it changes the original page's name too...not just the alias.

So, my next question is - is it possible to have a page alias that has a different name than the original page?
scalait replied on at Permalink Reply
scalait