Home > PHP Framework > YII > body text

What is zii in yii?

青灯夜游
Release: 2020-07-18 11:00:08
Original
2893 people have browsed it

zii is a component library provided by the YII framework, including list view ListView, table view GridView, and also includes some JQuery-based UI components, such as AutoComplete, DataPicker, Button, Drag and Drop, etc.

What is zii in yii?

The zii component library of the YII framework includes list view ListView, table view GridView, and also includes some JQuery-based UI components, such as AutoComplete, DataPicker, Button , Drag and Drop, etc. Zii components are mainly defined in the package zii. ,zii.widget.

Note: Since some of the UI components are closely related to the data source (Data Provider), it is necessary to introduce the database interface supported by Yii first.

Zii component-Menu example

Menu uses an Html list to display a multi-level menu. Menu configuration is configured through its attribute item. Each menu item includes three main attributes.

  • visible Whether it is visible

  • active Whether the current menu item is selected,

  • items submenu items .

In addition, it also includes the following attributes:

  • label: optional, menu name, supports the use of HTML tags.

  • url: Optional, click on the menu to redirect the URL link

  • template: Optional, menu template

  • ##linkOptions: array, optional, additional HTML link attributes

  • itemOptions: array, optional, additional HTML attributes for displaying menu items.

  • submenuOptions: array, optional, additionally display the HTML attributes of the submenu

Generally, the Menu can be defined in the Layout layout, such as this For example, modify protected/views/layout/main.php

 <?php $this->widget(&#39;zii.widgets.CMenu&#39;,array(
            &#39;items&#39;=>array(
                        array(&#39;label&#39;=>&#39;Home&#39;,
                            &#39;url&#39;=>array(&#39;/site/index&#39;)),
                        array(&#39;label&#39;=>&#39;About&#39;,
                            &#39;url&#39;=>array(&#39;/site/page&#39;,
                            &#39;view&#39;=>&#39;about&#39;)),
                        array(&#39;label&#39;=>&#39;Contact&#39;,
                            &#39;url&#39;=>array(&#39;/site/page&#39;,
                            &#39;view&#39;=>&#39;contact&#39;)),
                        array(&#39;label&#39;=>&#39;Login&#39;,
                            &#39;url&#39;=>array(&#39;/site/login&#39;),
                            &#39;visible&#39;=>false),
                        ),
        )); 
 ?>
Copy after login

Recommended related articles and tutorials: "

yii Framework Tutorial", "PHP Tutorial"

The above is the detailed content of What is zii in yii?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template