Created
March 21, 2013 08:58
-
-
Save ibndawood/5211668 to your computer and use it in GitHub Desktop.
Accessing a View function in a helper. The current view object is stored in the _View attribute of the Helper class is extended by AppHelper and all other Helpers in CakePHP. $this->assign is a view function and if you want to use this view function in a Helper this is how we use it :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('AppHelper', 'View/Helper'); | |
class MyHelper extends AppHelper{ | |
public function assignTitle($pageTitle){ | |
return $this->_View->assign('pageTitle', $pageTitle); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment