Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Why is the URL wrong?

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

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

Page: 1
Go to End
Author Topic: 2341 Views
  • Decisive Flow
    Avatar
    Community Member
    73 Posts

    Why is the URL wrong? Link to this post

    We have this cool little function for the website http://www.southcoastgallery.co.nz:   ;

    function ExhibitionLink(){
          $exhibition = DataObject::get_one('Exhibition');
          return $exhibition->URLSegment;
       }

    On the homepage, it means if you click on any of the images on the right, it should add ?imagenumber to the end.

    However, this actually doesn't. The URL segment it creates is the default one when you make a new page, not the one and only existing exhibition page

    We're not coders and I didnt even make this website and am stumped.

    Help!!!!!

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Why is the URL wrong? Link to this post

    As the link works, it appears that you have an Exhibition page with the title New Exhibition in your site root.

    You may be able to use $Top.URLSegment instead.

  • Decisive Flow
    Avatar
    Community Member
    73 Posts

    Re: Why is the URL wrong? Link to this post

    Woohoo!! THANKS!!!

    There is no pay int he root with that type, I checked, but the Top.URLSegment worked a treat.

    I cant believe I wasted half a day on this, I owe you big time

    Thanks again,

    Nat

    2341 Views
Page: 1
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.