Some useful HTML elements in Yii
Some useful HTML elements in Yii
Create Html Link in Yii
- The code below creates a html link to user view which has id = 23
<?php echo CHtml::link(CHtml::encode(View User with ID = 23), array(user/view, id=>23)); ?> - The code below creates a html link to the html form for creating a user
<?php echo CHtml::link(CHtml::encode(Create User), array(user/create)); ?>
Create Html Label in Yii
The code below creates a html label
<?php echo CHtml::label(CHtml::encode(Some Text), Some Text); ?>
Create Html ComboBox in Yii
The code below creates a html combobox
The code belows creates a html combobox with list data populating dropdown from database values
<?php echo $form->dropDownList($model, field_name, array(1=>test1, 2=>test2));?>
<?php echo $form->dropDownList($model,node_types_id, CHtml::listData(NodeTypes::model()->findAll(array(order => name)),id,name));?>
download file now
Comments
Post a Comment