Tuesday, December 18, 2012

Password Validation In Yii Model

From my sourcecode, I gave the information for password validation in yii framework. I used password and confirm password validation.
Read More...

Email Validation In Yii Model

From my sourcecode, I gave the information for email validation in yii framework.
Read More...

Username Validation In Yii Model

From my sourcecode, I gave the information for username validation in yii framework.
Read More...

Wednesday, October 10, 2012

Yii Framework Theme (Mehesz)

Read More...

HTML TO PDF IN YII FRAMEWORK

Download the files using below link to generate html to PDF files.
Download HTML2PDF

Next: Extract it and you will get following folders and files Folder _class _tcpdf_5.0.002 locale Files html2pdf.class Next: Create Folder inside extension of yiiframework as "tcpdf". Copy above files and folders and paste into "tcpdf" folder. Next: html2pdf.class has contains "HTML2PDF" class. I changed html2pdf.class file name as "HTML2PDF" (For my use) Call this view from controller.
Ex. In reportview.php Ex: In reportviewcontent.php I configured pdf page in reportview.php and put content separately in reportviewcontent.php
Read More...

Yii Model On Insert, Update And Change Password


When I wrote code for change password in yii framework, I was written above code. In this code i used scenario for model. So the rule of models was configured based on scenari concept of yii framework.It was working fine for me.
Read More...

Tuesday, October 9, 2012

Enyo JavaScript Supported Platforms

Enyo JavaScript Framework Supported Platforms 
iPhones, iPads, iPod Touches, Android phones and tablets, 
webOS phones and TouchPad, Windows Phone devices, AND on
the web in Chrome, Firefox, Safari, and IE 






Read More...

Enyo JavaScript Tutorial Sample 1


<!DOCTYPE html>
<html>
<head>
  Enyo Js Sample 1
  
  


  
</body>
</html>

Output Html Code:

<html class=" enyo-document-fit">

<head>
  Enyo Js Sample 1
  
  


Hello, World!

</body> </html>
I wrote some javascript using enyo js. Output Of this Sample code is

Hello, World!

on webpage using enyo js.
Read More...

Monday, October 8, 2012

Yii Books

Yii 1.1 Application Development Cookbook. Learn to use Yii more efficiently through plentiful Yii recipes on diverse topics. Make the most efficient use of your controllerand views and reuse them. Automate error tracking and understand the Yii log and stack trace Download

Agile Web Application Development with Yii1.1 and PHP5 is an introductory book describing how to use Yii to develop a real world project using the test-driven development(TDD) methodology. Check this out if you want to quickly master Yii. Download
Read More...

Thursday, September 27, 2012

How To Handle CJuiTabs In Yii


I created this yii cjuitabs article from my experience.When you read this article you can understand the yii cuitabs to handle differenct way.When i work on project, I need to assign the color for each tabs. I did this using span.

Static CJuiTabs

<?php
$this->widget('zii.widgets.jui.CJuiTabs', array(
        'tabs' => array(
               'Tab 1' => 'Content for tab 1',
               'Tab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),
               // panel 3 contains the content rendered by a partial view
               'AjaxTab' => array('ajax' => $this->createUrl('...')),
         ),
         // additional javascript options for the tabs plugin
        'options' => array(
  //Click the selected tab to toggle its content closed/open.
   //To enable this functionality, set the collapsible option to true
  'collapsible' => true,

   //Open CJuitabs on mouse over
  'event'=>'mouseover',   
         ),
));
?>

This is the normal CJuiTabs view in Yii framework. Just create the tab and assign content for that tab. 

Here I did 3 things. They are

  1. Static Content  for Tab l 
  2. Static Content with ID for Tab 2
  3. Content added dynamically using ajax url

Render CJuiTabs

<?php
$this->widget('zii.widgets.jui.CJuiTabs', array(
 'tabs' => array(
  'Tab 1' => 'Content for tab 1',
  'Tab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),
   
  // panel 3 contains the content rendered by a partial view
  'AjaxTab' => array('ajax' => $this->createUrl('...')),
  
  // Get Content From Another page. Also Pass Parameter
  'Render View'=>$this->renderPartial('_newpage',
   array('value'=>$value),TRUE) ),
  // Render view with ID
   'Render View With ID'=>array(
     'id'=>'renderid'
     'content'=>$this->renderPartial('_newpage2',
       array('value'=>$value),TRUE
    ),
 ),
 // additional javascript options for the tabs plugin
 'options' => array(
  'collapsible' => true,
 ),
  
'id'=>'MyTab',
));
?>
 
In this code, We can add content using renderPartial method in CJuiTabs. Here i added one parameter that is "value"(Optional)

Dynamic CJuiTabs

<?php
$tab_list=Componenttabs::gettabs();
$tabarray=array();
$i=1;

// Create Dynamic Tabs 
foreach($tab_list as $key=>$value){
 $tabarray["Tab $i"]=array(
     'id'=>$i,
    'content'=>$this->renderPartial('_newpage',
      array('value'=>$value),TRUE)
     );
 $i++;
}

$this->widget('zii.widgets.jui.CJuiTabs',
 array( 
   'tabs'=>$tabarray,
   'options'=>array(
    'collapsible'=>true,
   ),
   'id'=>'categorytabs',
  ));
?>

components/Componenttabs.php
<?php
class Componenttabs extends CApplicationComponent{
public static function gettabs(){
$model=Category::model()->findAll();
$listdata=CHtml::listData($model,”,’name’);
return $listdata;
}
}
?>

This is my great work of my project. I created dynamic tabs and content.


CJuiTabs With Class(Style)

<style type='text/css' >
 .tabclass{
   color:'red';
   font-weight:bold; 
  }
</style> 
// Css class for dynamic CJuiTabs
<?php 
  $tabarray["<span class='tabclass'>Tab $i</span>"]=array(
       'id'=>$i, 
      'content'=>$this->renderPartial(
       '_newpage',
       array('value'=>$value),
       TRUE)
      );
?>

// Css class for static CJuiTabs
<?php
$this->widget('zii.widgets.jui.CJuiTabs', array(
        'tabs' => array(
               '<span class='tabclass'>Tab 1</span>' => 'Content for tab 1',
        ),
));
?>

When you create dynamic tab using $tabarray["Tab $i"], You can apply color class using span tag.

Hint: When you use more than one CJuiTabs "Dont Forget" to set "ID". Otherwise you will get some problem

 

Dynamic Yii CJui Tabs Menu With Color

<?php
$tablist=array("Red","Green","Blue");
foreach($tablist as $tabs){
    $css='';
  if($tabs=='Red'){$css='color:red;';}
  else if($tabs=='Green'){$css='color:green;';}
  else if($tabs=='Blue'){$css='color:blue';} 
  $tabarray["<span id='tab-$key' style='$css'>$tabs</span>"]="$tabs Color";
}
?>
<?php
$this->widget('zii.widgets.jui.CJuiTabs',array(
    'tabs'=>$tabarray,
    'options' => array(
        'collapsible' => true,        
    ),
    'id'=>'MyTab-Menu1'
));
?>

Yii CJui Tabs Mouse Over Event

<?php
$tablist=array("Red","Green","Blue");
foreach($tablist as $tabs){
    $css='';
  if($tabs=='Red'){$css='color:red;';}
  else if($tabs=='Green'){$css='color:green;';}
  else if($tabs=='Blue'){$css='color:blue';} 
  $tabarray["<span id='tab-$key' style='$css'>$tabs</span>"]="$tabs Color";
}
?>
 <?php
$this->widget('zii.widgets.jui.CJuiTabs',array(
    'tabs'=>$tabarray,
    'options' => array(         
        'event'=>'mouseover',
    ),
    'id'=>'MyTab-Menu-Mouse'
));
?>
Download Yii CJuiTabs
Read More...