Search

I’m logging an issue Rob… (sorry)

Not a problem - I need to keep on top of this!!

Robert, I’ve sent you a pull request. Nice extension indeed, thank you! :)

URL Router updated to version 0.4 on 31st of August 2010

Apologies for my lack of activity on this, there have been pull requests waiting for some time and I have only just got around to integrating some of them. I’m also very busy outside of work so I can only apologise for my tardiness!!

Thanks to those who have fixed issues, and apologies to those whose amendments are still waiting, there is some non-standard behaviour that I need to look at which I’m not willing to integrate without closer inspection.

On a related note - I am aware that there are a few routing extensions floating about, and perhaps it would be beneficial to get all the useful behaviour into a single extension. I’m sure there are other cases where consolidating behaviour into a single plugin (or simply picking the best and ditching the resr) would benefit the community as there would be fewer extensions to trawl through to find any given behaviour.

Love the extension but seems to be (superficially) broken, logged an issue.

need to make “/company/brands/” go to “/company/brands/owned-brands/” ??
Any help?

@into, I’m sure there was a ‘redirect to first subpage’ extension floating around here somewhere…

@designermonkey, there is. I’m not really sure it fits the bill though, it depends on the kind of redirect into is looking for.

@into: if the owned-brands is a subpage of brands, and you want to redirect to that page when a user visits brands, this will fit the bill. If you are looking for something that will change the url, while still using the brands page, it won’t ;)

Good luck!

Yah, I stumbled across that thanks to a heads-up from Allen, too bad there isn’t a single solution for all, but yah first subpage extension will likely find its way into all my projects! lol

I'd like to be able to use this extension in an upcoming project, I was wondering if anybody could post examples of the code they used? I'm looking to do something much like what Nick mentions earlier, where a "clients" page with a variable looks like it is a sub-page. Any and all examples would be helpful, however.

Sure. I'm using it for a site where there are the following pages for an "Articles" Section:

  • Index of articles
  • Single article
  • Index filtered by tag
  • Index paginated

So we have 3 Pages setup in Symphony to keep things nice and clean:

  • articles-index, URL params page
  • articles-show, URL params title
  • articles-tags, URL params tags/page

The URLs we want to support are:

  • http://domain.com/articles/
  • http://domain.com/articles/page/2/
  • http://domain.com/articles/tags/name-of-tag/
  • http://domain.com/articles/tags/name-of-tag/2/
  • http://domain.com/articles/title-of-article/

And to rewrite the URLs I have the following setup in the URL Router:

  • From /\/articles\/tags\/(.+?)/i to /articles-tags/$1
  • From /\/articles\/page\/(.+?)/i to /articles-index/$1
  • From /\/articles\/(.+?)/i to /articles-show/$1
  • From /\/articles\/?$/ to /articles-index

Note that the order of the rules is important. They'l get matched top to bottom so you need to set rules from in order of most to least specific. Also, you could name your page to match your URLs if you like and reduce the rewrites a little. For a simple structure this way keeps things pretty clear without worrying about overhead.

Nice... this extensions allows me to organize my pages while still keeping sensible and user-friendly URL's. Thanks Rob!

For what it's worth, the regex for my example earlier in the thread is almost identical to Max's. Thanks for posting these up :-)

Thanks! Will look into these.

Extension updated

To version 1.0 on Fri 8th July.

Rob has handed the extension over to the Symphony Team to maintain as he no longer uses Symphony.

Disclaimer

The new version of this extension is not compatible with the older v0.x line. You can install the extensions simultaneously, and then copy the routes from one to the other before un-installing the old one.

If anyone has any outstanding pull requests waiting to be submitted, I'm afraid you may have to re-check this code and merge them before submitting the pull request to the new repo which is located at http://github.com/symphonists/url_router

You will find git download paths there.

Edited to account for version 1.0.1, Sat 9th July

Extension Update

To version 1.1.0

What has changed?

Introduces an update script from version 1.0 only, not previous versions, for previous versions please follow the instructions above.

Introduces the ability to choose either a route or redirect, instead of having a global switch to redirect pages. This adds power to your routes with granular control of what is physically or silently redirected.

All original routes are set to silently redirect, so if you need to change these to physically redirect, please change this in the database to redirect under the type column.

More updates coming soon...

I'm thinking of using the URL Router extension for a conference site where I'm thinking that I'll want to be able to have conferences organized by year.

The root page should default to the current year:

http://example.com/

So, the home page would be identical to the current year:

http://example.com/2011/

But I would also like to archive past years:

http://example.com/2010/
http://example.com/2010/overview/
http://example.com/2010/sponsorship/
http://example.com/2010/schedule/
http://example.com/2010/speakers/
...

If each year will have a different design, should I just create new pages for each year? Or should I use the URL router extension to handle routing for each year? I'm leaning toward the latter, since the conference organizers would be able to just create a new year for the annual conference.

I suppose there might be a possibility that the conference could expand in frequency and geographical reach. So, I would also want to be forward thinking to accommodate something similar to An Event Apart where events are listed by year and city.

/:year/:city/:page/

What would be the best approach?

Sounds like a plan!

For starters, I'd want the year to be the URL param of the homepage, and have it defaulted to the current year in the XSLT, so that when it's not explicitly set, it always shows this year.

For the other sub pages, I'd have a separate page for each one that accepts a parameter of the year, and route to that page using the following for example:

From: /\/(\d{4})\/overview/
To: /overview/$1/

You will have to repeat these for each page. It gives you the parameter to adjust which design is used, and allows designs to be dropped in as templates when required to be called in to the page!

Hope this helps...?

Thanks, @designermonkey. That reaffirms my first hunch. That's very helpful.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details