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

Pulling data from DB to template


Go to End


1697 Views

Avatar
hitautodestruct

Community Member, 19 Posts

28 January 2008 at 2:06am

Edited: 30/01/2008 12:04am

I know this should be super easy but I can't get my head about how to do this in the sapphire framework.

I have a control block:

<a href="<% control Level(1) %>$Prefix<% end_control %>SomePage">SomePage</a>

As you can see it simply goes to the top level page and gets the $Prefix field.
My question is how can I make a function that will do the same thing only with one template command. Something like:
<a href="{$WritePrefix}SomePage">SomePage</a>

Or better yet, is there a way to get the prefix from the top level and place it in every <a href=""> ?