Here's a simple way to create a Recent comments showing widget to be used in your templates. The idea is just to highlighting your blog's new comments.
Here's a simple way to create a Recent comments showing widget to be used in your templates. The idea is just to highlighting your blog's new comments.
To extend the functionality of you web application relative to your requirements you are supposed to use existing yii core libraries or use external libraries. There are some steps to ensure security, uniqueness, modularity, performance and to avoid rework in future.
The CMenu class provides some useful features for generating menus in your web application.
Lets say we have such a CGridView widget showing a list of users for administrator. Users have status „active“ or „disabled“. Grid widget puts class „odd“ or „even“ to rows and we want to preserve this. So we want to add a class „disabled“ to rows with disabled users.
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'user-grid',
'dat...
We all know that widgets are really useful. We can use the almost everywhere we want, and we can use the same code a lot of times ( Almost OOP ).
I've seen lot of people struggling in finding a way to hide the script name when installing their Yii Application. In an Apache environment everything is well documented in this wiki article, but for those who are running their app on a Windows Server machine there are no hints.
This wiki describes a more complex workflow using the XUpload widget
In case of a multilingual application, one might consider it a reasonable approach to store the preferred language of the user in a session variable, and after that, every time a page is requested, to check this session variable and render the page in the indicated language.
This tutorial shows a Yii-way of doing this.
We implement an event handler for the onBeginRequest event; as the nam...
When you develop a widget, you could need one image that is in the assets folder, you can use it simply within a css. You can load a css or javascript script doing this:
Yii::app()->getClientScript()->registerCssFile($filename);
CFormatter is one of Yii's core components and used to format values displayed in widgets like CGridView or CDetailView. All classic formats like numbers, text, urls or datetime are supported but you may have to use a formatting rule that isn't built in. Let's say we want to display arrays of strings (like tags associated with a product model)...
在经过畅K网的实战后,总结一下在Yii的项目中会经常用到的组件和一些基本的使用方法,分享给大家,同时也给自己留个备忘录,下面我以代码加图片说明.
All done, now we can call all the actionProvider actions as controllerID/actionPrefix.actionID. Here is the example:
Yii makes it really easy for all to use their already made objects that automate everything we do. It provides also great power of flexibility and styling but hey, we programmers tend to complicate our lives and push a little more the power of our tools.
The keywords will be stored in a text field in a comma delimited format. The keywords will be created by the site administrator.