Arguments passing

Hi!

How could I passing the variables into the layout file from the view? In the main.php layout I have the html:


<div class="title"><?php echo $pagetitle; ?></div>

And from different views I need to pass the different titles to the layout. For example, from main page I pass the "Home" value, from admin panel I pass "Administration panel" title.

In your layout file




<?php

<title><?php echo CHtml::encode($this->pageTitle); ?></title>

?>



And in your site controllers in the index action




<?php

$this->pageTilte = "Home";

?>



In your admin controller




<?php

$this->pageTilte = "Administration";

?>



etc

Spyros, thanks.

With page titles it works fine! But now I need one more variable to passing.

In the layout I write:


<div><?php echo CHtml::encode($this->headline); ?></div>

And in the view:


<?php $this->headline = "Admin panel"; ?>

It leads to exception:


Property "AdminController.headline" is not defined.

In your admin controller add

public $headline;

Thank you pal