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.

Template Questions /

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

$URLsegment and nested urls


Go to End


2 Posts   2402 Views

Avatar
yurigoul

Community Member, 203 Posts

26 April 2010 at 10:46am

(Sorry for crossposting, I just responded to a similar question in the Data Model Questions and later realized that template questions was a better place for this.)

I used to use 'Link' => Director::baseURL() . $page->URLSegment to construct an url to translations of a page.

However this does not work with nested urls because you get www.mydomain.com/sub-page/ instead of www.mydomain.com/parent-page/sub-page/

Any advice on how to make that work? Can I create a link based on the id of a page?

Avatar
yurigoul

Community Member, 203 Posts

27 April 2010 at 3:49am