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

How to create a link to an id


Go to End


9 Posts   11133 Views

Avatar
zim

Community Member, 135 Posts

13 November 2009 at 3:29am

Thanks for advice...

I just came up with a solution wherby I changed this

new DropdownField('StoryUrl','Select Url:',DataObject::get("SiteTree")->toDropdownMap()),

to this

new DropdownField('StoryUrl','Select Url:',DataObject::get("SiteTree")->toDropdownMap("URLSegment", "Title")),

and now it saves the URLSegment straight off and I do not have to worry about getting link from ID....

Not sure if my way is ideal so I may well have to use your code so Thanks again.

Go to Top