3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 247 Views |
-
Pass parameter

18 September 2012 at 8:05pm Last edited: 18 September 2012 8:08pm
Why wouldn't this work?
*in page.ss
<div class=" show$Opt(Count) half$Opt(Half) clearfix">
*in page_controller of Page.php
public function getOpt($opt = 'Count'){
switch($opt):
case('Count'):
return foo;
break;
case('Half'):
return bar;
break;
endswitch;
} -
Re: Pass parameter

20 September 2012 at 8:13am
Well I think that u should call for getOpt(...) instead of Opt, and the second thing is that u should a pass a string to a function.
-
Re: Pass parameter

21 September 2012 at 7:41am
The reason I ask is that I've only seen numbers passed as parameters in all the Silverstripe examples. I will take the string approach and see if that makes the fix.
| 247 Views | ||
|
Page:
1
|
Go to Top |


