Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Urls, why no 'sublevel' urls?

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

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

Page: 1 2 3 4 5 6 7
Go to End
Author Topic: 31666 Views
  • Tobi2
    Avatar
    Community Member
    4 Posts

    Re: Urls, why no 'sublevel' urls? Link to this post

    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.

  • tsimkins
    Avatar
    Community Member
    1 Post

    Re: Urls, why no 'sublevel' urls? Link to this post

    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.

  • dospuntocero
    Avatar
    Community Member
    54 Posts

    Re: Urls, why no 'sublevel' urls? Link to this post

    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?

  • Hemebond
    Avatar
    Community Member
    3 Posts

    Re: Urls, why no 'sublevel' urls? Link to this post

    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.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Urls, why no 'sublevel' urls? Link to this post

    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".

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Urls, why no 'sublevel' urls? Link to this post

    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/

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Urls, why no 'sublevel' urls? Link to this post

    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

  • dospuntocero
    Avatar
    Community Member
    54 Posts

    Re: Urls, why no 'sublevel' urls? Link to this post

    really happy to hear about this!

    31666 Views
Page: 1 2 3 4 5 6 7
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.