17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1973 Views |
-
print out a string

13 July 2007 at 5:02am
I have a controller that makes a string, then I return that string, how do I make the view render it.
This is what I have:
in the controller:
function printThis(){
$str = "Some string";
return $str;
}In the .ss template:
<% control printThis %>
<p>$str</p>
<% end_control %>What I have doesn't work, but is there any way to do this?
-
Re: print out a string

13 July 2007 at 8:21am Last edited: 13 July 2007 8:22am
Hi spullen,
To make things work how you want, you'll need this in your controller:
function printThis() {
$data = array(
'str' => "Some string"
);
return $this->customise($data);
}And and what you had in your .ss template will still work:
[html]
<% control printThis %>
<p>$str</p>
<% end_control %>
[/html]For more information on this syntax see: tutorial:4-site-search -> Showing the results
Have a great day,
Elijah Lofgren
-
Re: print out a string

13 July 2007 at 9:50am
Why not just
[code php]
function printThis(){
$str = "Some string";
return $str;
}and in the template
<% $printThis %>
?
-
Re: print out a string

14 July 2007 at 9:05am Last edited: 14 July 2007 9:05am
xmedeko, you are correct that this is a simpler way to go about it, but the template code would be this:
$printThis
without the <% and %>
| 1973 Views | ||
|
Page:
1
|
Go to Top |


