Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Urls, why no 'sublevel' urls?


Reply


51 Posts   31980 Views

Avatar
Sigurd

Forum Moderator, 628 Posts

20 October 2008 at 7:25pm

You can see there's been a nice lot of development done on this in the last month:

http://open.silverstripe.com/log/modules/sapphire/branches/nestedurls?rev=64221 shows some of work done over that time period.

Avatar
haswalt

Community Member, 16 Posts

21 October 2008 at 2:02am

Is this in a workable state yet?

Could we get away with checking this out and working it into our current development?

Harry

Avatar
Willr

Forum Moderator, 5513 Posts

22 October 2008 at 10:53pm

You can try it out for yourself by downloading the code via subversion -

svn co http://svn.silverstripe.com/open/phpinstaller/branches/nestedurls

Or you can download the zip at http://open.silverstripe.com/changeset/latest/phpinstaller/branches/nestledurls?old_path=/&filename=/phpinstaller/branches/nestledurls&format=zip I believe.

I don't think the code is production ready just yet but some good work being done so far :)

Avatar
haswalt

Community Member, 16 Posts

23 October 2008 at 3:10am

I think i may have found a better solution to this anyway.

I will let everyone know once it works completely and if my boss let's me release the code.

But as a heads up it's a very similar method to the way symfony handles custom urls.

Harry

Avatar
cshtauralrets

Community Member, 9 Posts

12 November 2008 at 8:02pm

Edited: 13/11/2008 4:25pm

I have a site as such, where there are perhaps 100 Things, so having the urls be /Bar-[0-100] is really undesirable. Thanks for the work on this feature.

Thing
- Bar
- Baz
- Eggs
Thing2
- Bar
- Baz
- Eggs

By the way, if I'm currently building a site as shown above, is there anything I should do now to make it easier in the future to have the site nest urls? If I build the site now with the current functionality, will I be able to take advantage of this feature when and if it's implemented?

Thanks.

Avatar
mobiusnz

Community Member, 3 Posts

18 November 2008 at 9:57pm

If nested urls do become part of the core (as I hope), has there been much thought as to what to do with functions? /page/function wouldn't work too well as sub-pages might step on needed functions (or vice-versa).

Maybe there could be an option to specify how we want functions to be delimited? Some examples would be:

site.co.nz/page/sub-page#function
site.co.nz/page/sub-page?function
site.co.nz/page/sub-page.function
site.co.nz/page/sub-page~function

Avatar
ajshort

Community Member, 244 Posts

18 November 2008 at 10:04pm

By default, if there is a conflict, the page takes priority over an action. However, if you define an $allowed_actions on your controller (a good idea), any action conflicts found in this will be automatically rewritten.

Avatar
Hubertus

Community Member, 14 Posts

19 November 2008 at 9:38am

I suggest to introduce a default "index" function to somewhat emulate the standard of delivering an index.html when a directory is called.

A request to root/page/subpage/ would be handled by that default function and simply display the content of subpage (just as root/subpage would do right now), while root/page/subpage/add would execute the specific add function on subpage (root/subpage/add in SS 2.2).

In other words: a slash at the end of the URL simply displays that page, while anything after the last slash is a specific function. This way, pages can be nested as deep as one wants and still have a function, both with pretty and meaningful URLs.