Welcome Guest, Not a member yet? Register   Sign In
calling a public controller method from within a view
#6

[eluser]bigtony[/eluser]
I agree will all the previous comments, but as an aside it's worth remembering that you can easily setup helpers with functions that do stuff useful for a view.

Here's an example:
Code:
/*
* Returns a formatted decimal value for viewing
*/
function format_decimal($value, $currency='£', $decimals=2) {
    return  $currency . number_format($value, $decimals);
}

Then in your view:
Code:
<p>The cost is &lt;?php format_decimal($some_value); ?&gt;, a great bargain!</p>
Which will produce something like "The cost is £1,234.56, a great bargain!"


Messages In This Thread
calling a public controller method from within a view - by El Forum - 10-02-2009, 09:41 AM
calling a public controller method from within a view - by El Forum - 10-02-2009, 09:46 AM
calling a public controller method from within a view - by El Forum - 10-02-2009, 10:15 AM
calling a public controller method from within a view - by El Forum - 10-02-2009, 10:16 AM
calling a public controller method from within a view - by El Forum - 10-02-2009, 10:39 AM
calling a public controller method from within a view - by El Forum - 10-03-2009, 04:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB