HTML & Yii


What would be the best way to add a condition in the html page (view) to show certain elements based on data in the model?


<?php if ($model->showElements):?>

bla bla

<?php else:?>

no bla bla

<?php endif;?>

Thanks, I was still thinking along the java/struts side a looking for a taglib.

Can any one help me out? I have two links and want to arrange them side by side instead of up and down. how will I go about it? this is my code.

<p><?php echo CHtml::link(‘Previous page’,array(‘courtCase/create’)); ?></p>

<p><?php echo CHtml::link(‘Next page’,array(‘comments/create’)); ?></p>

U should put them both in same <p> and just add some styling, if U check CHtml::link U will se that last param is HtmlOptions .

1 Like