Hi, I’m newbie on Yii. I notice there has a variable $content in Yii’s layout. But I don’t find where $content from. How Yii handle $content as real content or where Yii assign content to $content?
Thanks,
Hi, I’m newbie on Yii. I notice there has a variable $content in Yii’s layout. But I don’t find where $content from. How Yii handle $content as real content or where Yii assign content to $content?
Thanks,
Hi my friend
There is a mechanism of Yii core that creates for you this variable,
so when you use layout view like layout/main.php or layout/column1.php etc the $content variable contains the view content (controller/action render) and then passing into the layout.
In the case of column2.php layout, the "first" $content (inside column2.php) reflect the view content (controller/action -> render)
and then the generated output of layout2 passed into the main.php as $content variable again.
Thanks guys! It’s clear.