Remember me? forgot password | register

SilverStripe Forum

1133 Posts in 321 Topics by 311 members

Jump to:

Website Authors

If this is your first visit, you will need to register before you can post. However, you can browse all messages below.

Community » SilverStripe Forum » Website Authors » Why is the URL wrong?
Page: 1 go to end Reply
Author Topic: Why is the URL wrong? 1332 views
  • natalie
    avatar
    Community Member
    71 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
    Community Member
    185 posts
    2 SilverStripe Sites

    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.

  • natalie
    avatar
    Community Member
    71 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

    1332 views
go to top Reply

Currently Online:

ChrisBryer, tiga, EdP, jmccann

Welcome to our latest member: Luca