Call Controller Functions or Access Controller Variables from Views
By the convention of the MVC design pattern, I think it may not be recommended, but it is sometime very useful for the sake of ease & simplicity.
If you have a controller variable var1 & a controller function func1(), you can call them directly from your views like the following:
<?php
$this->controller->func1();
echo $this->controller->var1;
?>
Again, (over) referencing the controller from the view is not recommended.
About this entry
You’re currently reading “Call Controller Functions or Access Controller Variables from Views,” an entry on anupom.toString( );
- Published:
- January 8, 2007 / 5:27 pm
- Category:
- CakePHP
- Tags:
1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]