Advertisement
gareth126

passing vars to view

Nov 14th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. //action in index controller
  2.  
  3. public function indexAction()
  4.     {
  5.         //create a variable in the index action to be passed to the view
  6.         $this->view->varName = 'some text';
  7.     }
  8.  
  9.  
  10. //html in index view
  11.  
  12. <h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
  13.    
  14. <p>the value set in the controller for this view is <?php echo $this->varName; ?>.</p>
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement