passing data to the main template

Hi

How do you pass data from the controller to the main.php / outer template?

I can pass data directly to the view content by using :




$this->render('map',

   array('area'=>$area,'footerLinks'=>$footerLinks) 

);



But not sure about passing the data to the outer template wrapping around my map view in this case

In the view of the main template the object $this is the actual controller.

So you can define a property in the controller and use this like data.

Pay attention that data that will be rendered in the main view are expected to be available in all controllers that use this view, so is better to create an intermediate object (like Controller in components) in wich you define all properties that should be renderend in the main view.

So take a look at Controller and how the mainMenu is rendered in the main view. Is an example about how to do

Also don’t miss mindplay’s interesting thoughts on this:

http://www.yiiframework.com/forum/index.php?/topic/4473-how-to-pass-variable-to-a-layout/page__view__findpost__p__52166

can you kindly explain this more?

I have login form, wherein, it only appears, once you clicked the login link at the default navbar,

but how should I make the login form appear ang work at the main.php file ?,

because the UI i have, has the login input fields at the main page of the app

You should create a compoment, an input widget for display it in the layout.

A compoment is a "small controller" that can perform a single task. Take a look here.

This uses CJiuDialog and is even a bit too much, but you can understand the philosophy of widget at least and redo in a simplier way.

Hope it helps.

but the login field is embeded at the upper right corner of the main page UI, any other suggestion ?