Jump to content

[Zend] - $this in different phtml page


TFT2012

Recommended Posts

Hi, I have a newbie question again here.

Now I am really confused with $this in each phtml page. Like, I have a IndexController.php in controller folder, then correspondingly, will have a index folder underneath the view->scripts folder. Then inside the views->scripts->index folder, each phtml file, the $this will refer to the IndexController object. Am I right?

 

If I am correct above, then Zend wants us to use layout. For application->layouts->scripts folder, I create a phtml file named main.phtml ( follow the Zend quickstart guide ). Inside the main.phtml, it contains $this too, like $this->layout()->content. There is no such a controller like xxxxController for layout, I am wondering which object this $this refers to? Why can it invoke layout() and content, where do these two come from?

I only thing did for layout was adding "resources.layout.layoutpath = " in Bootstrap.ini.

 

Please help, thanks!

Link to comment
https://forums.phpfreaks.com/topic/266344-zend-this-in-different-phtml-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.