Foreach Readmore

Hi i have foreeach that list all row now i want it to have a button for readmore that slidedown below…

Hi,

you have to create two seperated actions (or better one with a parameter)

for example


//controller

function actionViewArticle($full=null) {

....

$this->render($model,array('isFull'=>$full));

}


//view

if ($isFull) echo $model->fullContent; else  $model->headContent;

echo CHtml::link('read more...',array('viewarticle',array('full'=>1)));

i’ve done like this in my view




	<font style="color:#0066FF"><b><?php echo CHtml::encode($data->topic); ?></b></font>

 

<?php

	echo CHtml::ajaxLink(

		CHtml::button('+',array('style'=>'width:18px;height:19px;'))

	,

		array('test/readcontent'),

		array(

		'update'=>'#readcontent'.$data->message_id,

		'type'=>'POST',

		'data'=>array('id'=>$data->message_id),

		

		));




?> 

<div id="readcontent<?php echo $data->message_id;?>"></div><br/>

<div align="center"> <hr style="width:85%;"/></div>

 



when i click the button it calls the function that show bellow the content now the another problem it should slide up if i click again the button any help…

Hi,

You can use javascript extensions to perform this no need to hit the server for sliding up and down. For example you can check the below url

http://jedfoster.github.io/Readmore.js/