OnlyPHP

2013年5月6日

CGridView: Update/create records in a CJuiDialog

摘要: CGridView: Update/create records in a CJuiDialog Follow @yiiframeworkreport it11024 followersNote: This code is now part of the extension quickdlgsStep 1Step 2Step 3And what's about the action create?TipNote: This code is now part of the extension quickdlgs ¶My article Display the full reco 阅读全文

posted @ 2013-05-06 15:13 OnlyPHP 阅读(924) 评论(0) 推荐(0) 编辑

Using filters with CGridView and CArrayDataProvider

摘要: Using filters with CGridView and CArrayDataProvider Follow @yiiframeworkreport it10023 followersModelControllerViewUsing filters on CGridView with CActiveDataProvider is easy, but with CArrayDataProvider it is a bit tricky.To use the filters you have to create a separate model class. I used some cod 阅读全文

posted @ 2013-05-06 15:06 OnlyPHP 阅读(440) 评论(0) 推荐(0) 编辑

2013年5月5日

CTreeView 使用

摘要: DocumentationTake the TourTutorialsClass ReferenceWikiScreencastsResourcesDisplay an AJAX tree from your DB using CTreeView Follow @yiiframeworkreport it20020 followersThe databaseThe viewThe controllerIf AJAX failsFinal noteThe database ¶This example uses a MySQL DB with a table named tree wit 阅读全文

posted @ 2013-05-05 14:37 OnlyPHP 阅读(248) 评论(0) 推荐(0) 编辑

CMenu遍历

摘要: 由数据库控制的CMenu菜单张迪 发表于2012年01月04日 | 查看4330次 | 评论(1) | 关注(1)顶(1) | 踩(0)这是一个简单的基于数据库的菜单系统,它使用 CMenu 渲染.数据库结构CREATE TABLE IF NOT EXISTS `menu` ( `menu_id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `date_added` datetime NOT NULL, `last_updated` datetime NOT NULL, `status` enum('a. 阅读全文

posted @ 2013-05-05 14:23 OnlyPHP 阅读(291) 评论(0) 推荐(0) 编辑

ar 查找的使用

摘要: Yii AR很好很强大,但刚开始不知道怎么使用 如果英文不错,可以直接看原文地址http://www.yiiframework.com/doc/guide/1.1/en/database.ar下面是我对AR的一些理解对于一个Model Post 有如下的4中查询方法,返回对象或者对象数组。//findthefirstrowsatisfyingthespecifiedcondition$post=Post::model()->find($condition,$params);//findtherowwiththespecifiedprimarykey$post=Post::model()- 阅读全文

posted @ 2013-05-05 11:21 OnlyPHP 阅读(245) 评论(0) 推荐(0) 编辑

Yii的rules验证(表单字段验证)

摘要: Yii的rules验证(表单字段验证)yii 验证rulesit分类:Yiiyii的rules验证cValidator主要属 性attributes,builtInValidators,enableClientValidation,message,on,safe,skipOnError经常用到的属性有attributes,builtInvalidators,message,on这四个下面是对应的验证类required:CRequiredValidatorfilter:CFilterValidatormatch:CRegularExpressionValidatoremail:CEmailVal 阅读全文

posted @ 2013-05-05 09:46 OnlyPHP 阅读(679) 评论(0) 推荐(0) 编辑

Yii实现Password Repeat Validate Rule

摘要: Yii实现Password Repeat Validate Rule发表回复在使用Yii时遇到这样的需求:在一个注册的页面输入两次密码,并验证两次输入是否一致。可是password的repeat的字段在数据库并不存在。问题来了,如何创建一个password_repeat的属性,进行密码验证。最偷懒的方法就是利用yii自带的验证器。在这里记录下实现的方法。假设项目结构如下protected/models/User.phpproteced/controllers/SiteController.phpprotected/views/site/forgot.php首先在User.php添加一个publ 阅读全文

posted @ 2013-05-05 09:44 OnlyPHP 阅读(280) 评论(0) 推荐(0) 编辑

2013年5月3日

phpexcel 使用一,解决自动加载问题

摘要: Yii框架中使用PHPExcel导出Excel文件最近在研究PHP的Yii框架,很喜欢,碰到导出Excel的问题,研究了一下,就有了下面的方法:1、首先在config\main.php中添加对PHPExcel的引用,我的方式是这样:12345678//autoloadingmodelandcomponentclasses'import'=>array(/*'application.modules.srbac.controllers.SBaseController',*/'application.models.*','applicat 阅读全文

posted @ 2013-05-03 14:26 OnlyPHP 阅读(1368) 评论(0) 推荐(0) 编辑

2013年5月2日

网站记载

摘要: http://www.yiiframework.com/extension/tlbexcelviewhttp://hi.baidu.com/95857548/item/0130511b07297c532b3e2209 阅读全文

posted @ 2013-05-02 19:51 OnlyPHP 阅读(143) 评论(0) 推荐(0) 编辑

master-slave的实现

摘要: 今天本来是想研究一下AR模式的, 可是一不小心, 有陷入了master-slave的实现细节当中.研究之后我决定自己写一个master和slave链接的实现.当然首先让我们一起来看看我们常用的数据库查询需要的语句.$connection=Yii::app()->db;$command=$connection->createCommand($sql);$rowCount=$command->execute();标注为红色的地方引起了我的注意,于是有了以下几个想法:1) 这个db 明显是Yii 初始化的实例CwebApplication的一个成员变量, 但是在它及它的所有的父类中 阅读全文

posted @ 2013-05-02 16:20 OnlyPHP 阅读(674) 评论(0) 推荐(0) 编辑

导航