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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.