Cdetailview displays details for a model. The model to be displayed can be either a cmodel or an associative array.
Cdetailview configure attributes to determine which properties of the model need to display in what format.
Each property can be configured using Name:Type:Label. Where type and label are optional.
Name of the "name" property.
"Label" Optionally, the label name of the property, if not configured, using the property name as the label name.
The type of the "type" property, which determines the format to display by type formatter. The types you can use are raw, text, ntext, HTML, date, Time, DateTime, Boolean, number, email, image, Url. , and so on, the text is used by default.
This example modifies the previous example of the Yii Framework Development Tutorial (a) Zii component-listview example, modifies the list item template _view.php of the display list to make the customer name from plain text into link.
When you click on the customer's name, go to the link view.php, the incoming parameter CustomerID set to the customer ID.
Creating view.php, using Cdetailview components
Use the default format to display each of the customer's fields, the main Employee field, table customer defined is supportrepid as foreign key reference employee, so modify the class customer definition relations, reference yii Framework Development Tutorial (27) database-associated Active record example
Public Function relations ()
{return
array (
' Employee ' =>array (self::belongs_to, '
employee ', ' Supportrepid '),
);
}
The results appear as follows:
This example downloads: Http://www.imobilebbs.com/download/yii/DetailViewDemo.zip
See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm