Yii PHP Framework. Look up a class, method, property or event CWidget is the base class for widgets.
A widget is a self-contained component that may generate presentation based on model data. It can be viewed as a micro-controller that embeds into the controller-managed views. Compared with controller, a widget has neither actions nor filters. Usage is described at CBaseController and CBaseController::widget. Public Properties Hide inherited properties Property Details public string $actionPrefix; the prefix to the IDs of the actions. Returns the controller that this widget belongs to. public string getId(boolean $autoGenerate=true)public void setId(string $value) Returns the ID of the widget or generates a new one if requested. Returns the owner/creator of this widget. public mixed $skin; Fundamentals: Path Alias and Namespace.
Yii uses path aliases extensively.
Today I will demonstrate three simple and helpul methods. A simple way to add js, css by editing config/main.php ¶ 'components'=>array( 'clientScript'=>array( 'packages'=>array( 'jquery'=>array( 'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jquery/1/', 'js'=>array('jquery.min.js'), ) ), ), ), Using getClientScript ¶ Usually, We add in block of code into Controller or layout of your theme You can also add scripts from controller action.
We will develop these portlets by extending the CPortlet widget provided by Yii. In this section, we will develop our first concrete portlet - the user menu portlet which displays a list of menu items that are only available to authenticated users. The menu contains four items: Approve Comments: a hyperlink that leads to a list of comments pending approval;Create New Post: a hyperlink that leads to the post creation page;Manage Posts: a hyperlink that leads to the post management page;Logout: a link button that would log out the current user. 1. We create the UserMenu class to represent the logic part of the user menu portlet.
The UserMenu class extends from the CPortlet class from the zii library. Tip: Notice that we have to explicitly include the CPortlet class by calling Yii::import() before we refer to it the first time. Yii PHP Framework. Starship / RestfullYii Makes quickly adding a RESTFul API to your Yii project easy.
RestfullYii provides full HTTP verb support (GET, PUT, POST, DELETE) for your resources, as well as the ability to offset, limit, sort, filter, etc… . You will also have the ability to read and manipulate related data with ease. RestfullYii has been lovingly rebuilt from the metal and is now 100% test covered! The new event based architecture allows for clean and unlimited customization. How it works ¶ RestfullYii adds a new set of RESTFul routes to your standard routes, but prepends '/api' . So if you apply RestfullYii to the 'WorkController' you will get the following new routes by default. [GET] (returns all works) [GET] (returns work with PK=1) [POST] (create new work) [PUT] (update work with PK=1) [DELETE] (delete work with PK=1) Requirements ¶ Special Topics: Theming and Skin. Theming is a systematic way of customizing the outlook of pages in a Web application.