Showing 661-680 of 826 items.

Configuring controller access rules to default-deny

Created 15 years ago by Steve Friedl Steve Friedl, updated 12 years ago by nsanden nsanden. 3 comments

Starting with the blog tutorial, Yii developers are familiar with the notion of access rules defined in the controller, where the actions are allowed or denied depending on the user's name or role.

class CommentController extends CController {
    public function filters()
    {
        return array( 'accessControl' ); // perform access control for CRUD operations
    }

11 0
12
Viewed: 145 447 times
Version: 1.1
Category: How-tos

Understanding Virtual Attributes and get/set methods

Created 15 years ago by Steve Friedl Steve Friedl, updated 14 years ago by GOsha GOsha. 20 comments

When you define or extend a class, you can create class variables and methods in Yii just like you can in any other PHP system:

class Comment extends CActiveRecord {
    public $helperVariable;
    public function rules() { ... }
    ...
}

and then use them in the obvious way:

$var   = $model->helperVariable;
$rules = $model->rules();

This part everybody understa...

66 0
44
Viewed: 218 354 times
Version: 1.1
Category: Tutorials

CGridView and AjaxForm Connect

Created 15 years ago by PinkBrainPlan PinkBrainPlan, updated 15 years ago by PinkBrainPlan PinkBrainPlan. 2 comments

<?php $this->widget('zii.widgets.grid.CGridView', array(

'dataProvider' => $dataprovider,
'id'=>'recipient_table',
    'selectionChanged'=>'updateEditForm',
'columns' => array(
	'rec_id',
            'org.nachname',
            'org.vorname',
            'org_id',
            array(
                'class'=>'CButtonColumn',
                'template'=>'{...
1 0
10
Viewed: 31 069 times
Version: 1.1
Category: How-tos

URL component access functions

Created 15 years ago by Steve Friedl Steve Friedl, updated 15 years ago by Steve Friedl Steve Friedl. 1 comment

Many applications wish to obtain parts of the URL for the current page (the hostname, the query string, etc.), and the CHttpRequest class wraps various $_SERVER variables to break down the URL into its constituent parts.

28 0
16
Viewed: 22 607 times
Version: 1.1
Category: Tips

The directory structure of the Yii project site

Created 15 years ago by qiang qiang, updated 13 years ago by Yang He Yang He. 42 comments

In this article, we describe the directory structure used by yiiframework.com - the official Yii framework website. While this structure may look overly complicated for small projects or may not be optimal in some sense, we believe it is appropriate for medium or large projects in a team development environment. In fact, we have successfully used the similar structure in some other big projects.

77 0
95
Viewed: 263 793 times
Version: 1.1
Category: Others