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.

Template Questions /

$URLsegment and nested urls


Reply


2 Posts   1660 Views

Avatar
yurigoul

Community Member, 202 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, 202 Posts

27 April 2010 at 3:49am

Solution is here: http://www.silverstripe.org/data-model-questions/show/281864?start=0#post283190