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

Why is the URL wrong?


Go to End


3 Posts   3134 Views

Avatar
Decisive Flow

Community Member, 73 Posts

22 April 2008 at 1:01pm

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!!!!!

Avatar
(deleted)

Community Member, 473 Posts

22 April 2008 at 2:30pm

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.

Avatar
Decisive Flow

Community Member, 73 Posts

22 April 2008 at 3:36pm

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