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.

Data Model Questions /

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

2.4 branch : nested urls and translation


Go to End


4 Posts   2476 Views

Avatar
pac

Community Member, 25 Posts

30 March 2010 at 5:32am

there seems to be a problem with nested urls and translation, $URLSegment does not return the entire path with the locale

any new parameter I should know about ?

Avatar
yurigoul

Community Member, 203 Posts

26 April 2010 at 10:28am

Would like to know this too, have the same problem, could not find anything in the docs.

Do I need to search the parent(s) every time I want to get an url, or is there a way to create a link using id, or ... ?

Avatar
MarcusDalgren

Community Member, 288 Posts

27 April 2010 at 2:25am

Edited: 27/04/2010 2:28am

The $Link variable in the templates seems to be working fine (running on 2.4 branch with Translatable), is $URLSegment really supposed to return anything else than just what's in the database field URLSegment?

The Link function in SiteTree does this:
return Controller::join_links(Director::baseURL(), $this->RelativeLink($action));
and the controller function with the same name simply calls the Link function on the associated data record so if you only want the link without http://... $this->RelativeLink() should give you what you need I think.

Avatar
yurigoul

Community Member, 203 Posts

27 April 2010 at 3:48am

Thank you so much! It worked!