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

Passing parameters from templates


Go to End


2 Posts   6202 Views

Avatar
obfuscato

Community Member, 1 Post

25 July 2011 at 8:29pm

Edited: 25/07/2011 8:30pm

I have a function

function doStuff($parameter){
    ...

    return DataObjectSet;
}

When I call in from a template

<% control doStuff(123) %>
    ....
<% end_control %>

It works as expected

But if I try to pass a variable as a parameter like $ID or $Title I get a "No Data Received" error

Is this not possible?

Avatar
swaiba

Forum Moderator, 1899 Posts

25 July 2011 at 11:42pm

Edited: 25/07/2011 11:43pm

Hi obfuscato,

Due to the template being parsed only once - no.

this is my work around... http://www.silverstripe.org/template-questions/show/13619#post290473

Hope this helps