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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

sending data to template


Go to End


2 Posts   631 Views

Avatar
ricktee

Community Member, 2 Posts

6 March 2016 at 1:28pm

I have a very simple function which produces a single array, how do I get this to display in the template?
I mean very simple like:

function DoThis() {
$a = 1;
}
how do i get $a to populate the $DoThis holder in the template?
push->
or just a staight echo ?? all help appreciated.

Avatar
fraxier95

Community Member, 8 Posts

10 March 2016 at 11:31pm

Assuming the function is accessible from the template you can just have the function return the array
function DoThis() {
return $a = 1;
}