display multiple actions on same page.

hi all… m trying to create a theme for my frontend.

for backend of my site i used column two layout…but now ill have to create a new layout as per the clients requirements… so i need to display the results of diff actions on the same page at different positions…

considering there is single $content how do i go about it?

ma layout is something like this…


| header |


| search |


|Advertisements | testimonials |


| footer |


One action renders one view and in general this leads to one page…

There are exceptions if you use ajax… that could be the idea for you to use…

This way you would make ajax calls to different actions and would update the parts of the page you need with the results…

Another solution would be to create widgets instead of actions… wigets can be thought of as page parts… for example advertisements can be result of the widgetAdvertisements… and so on…

Do you have actions for header and footer? As well as search, advertisements and testimonials?

I do search with a partial e.g. _search.php:




<?php $modelSearch=new Model('search) ?>

<?php $form=$this->beginWidget('CActiveForm',array(

	'action'=>array('controller/search'),

	'id'=>'search'

)) ?>

	<?php echo $form->labelEx($modelSearch,'search') ?>

	<?php echo $form->textField($modelSearch,'search') ?>

	<?php echo CHtml::linkButton('search') ?>

<?php $this->endWidget() ?>



And then render it as a partial on other views:




<?php $this->renderPartial('controller/_search') ?>



It posts to a search action which then saves the search string to session and redirects (using AttributeDefaultsPersister):




public function actionSearch()

{

	$modelSearch=new Model('search');


	// Save defaults

	if(isset($_POST['Model']))

	{

		$modelSearch->attributes=$_POST['Model'];

		$modelSearch->defaults->saveAsDefaults();

	}


	// Redirect

	$this->redirect(array('controller/browse'));

}



hi mdomba… thanks… could you please try to give an example which uses ajax…just for reference…

Too complicated to write a working example… and it all depends on your needs…

You need to have controller/action made for that…

for example

controller Advertisement has method actionDisplay that renders the advertisement box for the page…

controller Testimonial has method actionDisplay that renders the testimonials

You need to just render the box… not the whole layout as this are only smal lparts of the dashboard…

For jQuery document ready you make all the ajax calls you need… like calling "advertisement/display" and "testimonial/display"…

hi i can use renderPartial to get a view from one controller in another controller…

eg.


<? $a=new LoginForm;

    ?>


<?php $this->renderPartial('//site/login', array('model'=>$a))?>

which is working perfectly correct… but i have user Usergroups module for my app… which is in the modules folder… so how do i renderPartial the login form from a module?