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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Urls, why no 'sublevel' urls?


Go to End


51 Posts   36625 Views

Avatar
Tobi2

Community Member, 4 Posts

10 April 2008 at 8:46pm

Edited: 10/04/2008 8:49pm

I actually had to drop the idea of using SS on my last project since the customer would want to keep his urls the ways they've always been:

/product_a/support
/product_b/support

Besides the amount of code that needs to be changed wasn't it a major design flaw to interpret the urls as /path/action?

Since you expect mod_rewrite to be used anyway one could have a more generic system using parameters (action="", page="") and rewriting into nice urls.

Edit: A sidenote on this forum software/plugin. When writing a new post there is a tiny 'Post' button on the lower left but one easily clicks on the prominent 'Reply' button on the lower right ending up having to write the post again. :-)

Avatar
tsimkins

Community Member, 1 Post

6 June 2008 at 1:38am

Edited: 06/06/2008 1:39am

I'm new to SilverStripe as well, and first off, I'm very impressed. I'd characterize it as an "everything you need, nothing you don't" type of CMS.

Unfortunately, the one functionality showstopper in implementing it for our group is the lack of hierarchical URLs.

One solution that I haven't seen mentioned in any of the posts on the topic (although I may have just missed it!) is to use the site navigation hierarchy to determine URLs. In the current model, lets say we had a top level page called "AboutUs", (URL "/AboutUs/"), and then a subpage called "Our Staff" (URL "/OurStaff/"). What would make sense to me is rather than ONLY having a top level URL, to use that page-subpage relationship to determine the URL, and give the subpage a URL of "/AboutUs/OurStaff/".

Since those page-subpage relationships are already in the database, I would think it would be possible to only specify the URL fragment (i.e. "OurStaff") for the subpage in the user interface, and have it build out the hierarchy in another field in the database to use in conjunction with the mod_rewrite rule.

This way, the URL is absolutely tied to the hierarchy in the interface, and there's no manual maintenance (which we definitely don't want!) or ambiguity (Did someone mean their "Products/Services" page, or is "Services" a subpage of products?").

As far as fixing the hierarchy if you change a parent, we'd know when the parent changed, so we could then go through and update URL for the children.

Just off the top of my head, I'd suggest something along these lines:

- Add a "FullURL" field to the "SiteTree" table.

- Create a "calculateFullURL" MySQL procedure that would concatenate the parent's "FullURL" field with the subpage's "URLSegment" field. This procedure would also recursively run itself for all of its children.

- Create "update" and "insert" triggers on the SiteTree table to run that procedure.

- Modify the code that does that initial lookup to use the "FullURL" field rather than the "URLSegment" field.

- Modify the user interface so that on the form where you're specifying the URL segment, it prepends the parent's FullURL as text to the text box where you specify the URL segment.

Of course, that's a very simplified version, and you could also execute the same logic in PHP. It's just easier for me to describe in SQL terms since I haven't really looked into the code.

Avatar
dospuntocero

Community Member, 54 Posts

17 July 2008 at 10:41am

what about implementing the sublevel urls using the PageHolder/Page system you have developed as an standard for category/page?

looks pretty intelligent to me have something like this implemented.

if you want a url like animals/dog

you need to have at least 2 classes, one AnimalsHolder and one AnimalsPage for do the trick.
so the urls become mysite.com/AnimalsHolder/AnimalsPage

sounds coherent?

Avatar
Hemebond

Community Member, 3 Posts

4 August 2008 at 1:51am

Edited: 04/08/2008 2:07am

The web is based on URLs. A URL is a unique id for a resource. Unfortunately all the big content management systems I've ever tested break this and force the user to have a completely flat structure i.e., if the pages were actual files, they'd all be in the same directory. Some then try and cludge some URLs to make it look like there's a structure to the site.

I've tested 20+ CMSs this weekend trying to find one that does things properly to be used as an eCommerce site and I've found one. Unfortunately it's not mature enough to give to a non-developer so the search continues.

Edit
Just found one via OpenSourceCMS called Website Baker. I have no idea how good it is, but it got this part right.

Avatar
bummzack

Community Member, 904 Posts

4 August 2008 at 2:10am

Edited: 04/08/2008 2:11am

I've tested 20+ CMSs this weekend trying to find one that does things properly to be used as an eCommerce site and I've found one. Unfortunately it's not mature enough to give to a non-developer so the search continues.

What do you mean when you say: "does things properly"? Regarding URLs with multiple Levels? If you're looking for a feature like that in a CMS, you didn't look that hard. 2 CMS come to mind instantly: drupal or MODx
Maybe you could call MODx "not mature" (i wouldn't), but certainly not drupal.
Drupal needs some further configuration, see http://drupal.org/node/15365 and http://drupal.org/handbook/modules/path. MODx does the URL rewriting "out of the box".

Avatar
Liam

Community Member, 470 Posts

4 August 2008 at 5:38am

There is a patch in development that supports sub URLs. I've only tested it shortly on a development SS setup, and it seemed to work nicely. Can't say how stable it is, as I only just played around with it - nothing too serious.

http://sstest.grayzagdesign.com/nested-urls-dev/

Avatar
Willr

Forum Moderator, 5523 Posts

4 August 2008 at 11:14am

And the changes that have been done to the 2.2.2ROA branch - which will be merged back into the standard release for 2.3 has a few changes to Director and how it handles URLs which will make sublevel urls much easier to implement

Avatar
dospuntocero

Community Member, 54 Posts

4 August 2008 at 11:58am

really happy to hear about this! :)