Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zend framework "$this"

I am new into the Zend framework, and I have a basic question.

Assume I am working with the layout.phtml or with the index.phtml of any script.

When I am using "$this->" to what instance am I referring to?

I read in a book the following: "$this is available within the template file, and it is the gateway to Zend_View’s functionality".

Does it mean that I can access any method, of any class that lies in any file inside the library/Zend/View/Helpers directory?

Excuse me if this question is silly and/or simple enough.

Thank you

like image 526
yorgos Avatar asked Feb 09 '12 22:02

yorgos


1 Answers

$this-> In a view template is a reference to the Zend_view object you create in your controller.

Try var_dump($this) or print_r($this) (echo out a <pre> before the print_r for nicer formatting) in the template. Var dump might help you figure out what is going on a little better.

like image 78
Pete Mitchell Avatar answered Oct 16 '22 05:10

Pete Mitchell