Category Archives: Yii tips

CKEditor In Yii Framework

Download And Install CKEditor CKEditor With Yii Download And Install CKEditor CKEditor will helpful to create pages with large content. Normally we will use it “CMS” type of website, pages like “About Us”, “Terms and privacy”, etc . First we have to download the CKEditor using below url http:&#47& After downloaded it, We have to […]

How to display image in CDetailView Yii Framework 1.0

This tutorial will help you to display the image in CDetailview widget of yii framework 1.0. We added a different funcitons in model.php to display the image with different methods like only image, image with link, image from database etc. View.php <?php $this->widget(‘zii.widgets.CDetailView’, array( ‘data’=>$model, ‘attributes’=>array( array( ‘name’=>’image’, ‘type’=>’raw’, ‘value’=>$model->image_tag(), ), array( ‘name’=>’imagelink’, ‘type’=>’raw’, ‘value’=>$model->image_with_link(), […]

MetaTags In Yii Framework 1.0

In yii framework 1.0, Registers a meta tag that will be inserted in the head section (right before the title element) of the display page. Each call of this method will cause a rendering of new meta tag like keywords, description, robots etc, even if their attributes are equal. Syntax Keywords Description Content-type Cookie ROBOTS […]

Print Html View In Yii

Download Extension Print Table Download Extension Using the below link download the extension to take the print of html [Take print What you see]. Click here to download After download, Add the extension into follwoing directory “protected/extension/mPrint/mPrint” Print Table I added sample code to print the some view content <?php $this->widget(‘ext.mPrint.mPrint’, array( ‘title’ => ‘User […]

render And renderPartial In Yii

render renderPartial Another Controller View render render is used to display page with layout or theme. $this->render(‘login’,array(‘model’=>$model)); renderPartial The renderPartial() method is also used for Ajax calls, where the layout isn’t appropriate It will show content of particular view file only and will not include theme files like css, js, header, footer etc.[empty theme content […]

Timestamp Behavior In Yii

Normally we will add some fields in every table of application database. Ex createdby, createdon, modifiedby, modifiedon, lasteditedby, lasteditedon etc So we have to configure model for this action. Normally we will add beforeSave() method in every model. Instead of beforeSave in every model, We will create one behavior class and add this beforeSave method. Now we […]

Yii 1.0 Display Image Form Database

Before save the image into database, i created one ‘text’ field in mysql table to save the image code. We can show the image in CDetailview from database table of yii framework. Here i used showphoto_from_database() function to display the image from database. showproof_from_image_folder() is used to fetch uploaded image url from database and display. […]