Layout view files: beginContent() method default value

Hi all,

I am playing with layout in Yii, and have one question need your help.

As I looked into layout view file: "column1.php" I see the beginContent() method:


<?php $this->beginContent('//layouts/main'); ?>

As I read a guiedbook "Agile web development with Yii", it said:

As I understand that the layout specified at the controller level is "layout/column1" (as I have checked value $this->layout). so If I leave this layout empty in the beginContent() method, then it will render "layout/column1", am I right?

If so, the new loaded layout will reapeatly load the “layout/colum1” as there’s no layout value pass to beginContent() method at this new loaded layout. and I iffer that this will return an error.

But, when I leave this layout value empty. the view file still load as normal. no error occured.

I am very supprised with it.

Could someone tell me what has happened?

Thank you.

because the default layout is main if you remove the value of layout property it will still render that main layout until you set that layout property to false

The default layout here refers to the application’s default layout.i[/i].

In your case it may still be the mainlayout..

This is my attempt to explain layouts.

Layouts-Peeling the Onion.

Okay, Thank you both. Just to confirm my thinking with carefull taking your advice:

So, the text that I quoted above is no longer true?

Am I right?

Thank you.