5 users online. Create an account or sign in to join them.Users
Invisible URL handle for a page
This is an open discussion with 8 replies, filed under General.
Search
You can use the URL Router extension for that.
Yep, Symphony forces you to put URL Parameters at the end of URLs, but the URL Router extension lets you define regular expressions to rewrite URLs however you like.
But how would you work the logic for the URL Router? If you have two views for instance? Would you have to create separate pages?
Thanks guys. I am using .htaccess for the moment as I couldn’t understand Phoque’s code at first and I feel slightly uncomfortable using extensions if I can avoid. Also I am using RC3…
FYI, the code I used is:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^collections/(.+/?)$ index.php?symphony-page=collections/view/$1&%{QUERY_STRING} [NC,L]
So, anything that matches collections/somthingelse is redir’d to collections/view
The URL Router extension should be equally as easy to use (I’m using it with 2.0.8 RC3 without any problem). Once enabled, head to System > Preferences where you can add pairs of regular expressions. Something like:
^/collections/(.+/?)/$ /collections/view/$1/
It keeps your changes away from core files (if you consider .htaccess a core file).
Put simply, the extension stores these rules in the config.php file for quick read access. On each page load there’s a delegate that fires just as Symphony tries to resolve a URL to a known page. This extension subscribes to the delegate, iterates over the regular expressions and forwards on the request to the desired page if there’s a match.
Thanks for the explanation Nick. I guess since I already implemented the /view rewrite there shouldn’t be any refactoring involved if I switch to this extension, right?
My rationale for the .htaccess approach is that as long as it’s three lines in a semi-core file (it’s not even under Git’s control), I can take it, and I know how to fix it if things go wrong.
So thanks again for the quick summary; hopefully it’ll help me figure out other extensions too before I start to write my own.
This is about exactly what my extension root page params does.
You can specify a page to “dissapear” from the url, and still resolve.
Hope that helped.
Thanks, I’ll definitively give it a shot.
Create an account or sign in to comment.
Intense posting activity today…
Scenario
I have this url structure:
List is a Symphony page, whereas name and sub-name are URL parameters.
I want to have http://site.com/list with a very different look than http://site.com/list/name.
I am accomplishing this by using either xsl:call-template or xsl:apply-templates mode=”some-mode”. But it’s a pain when there are conflicting matches.
However it would be nice if there were a way to create a page for {name} so that I can use a different XSL stylesheet altogether.
NOTE: I would like to avoid http://site.com/list/view/name/…
Ideas? Subpage + modRewrite (fingers crossed there’s a better way)?