Bookcafe

Showing posts with label Yii. Show all posts
Showing posts with label Yii. Show all posts

Wednesday, May 29, 2013

Yii Application In The Making

I just follow the tutorial for Yii at http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app and the followings are the snap shots:


Please enter the password as provided in the ../protected/config/main.php and you will be directed to the following page:


I will not follow the table stated in the tutorial since I will use my own table i.e alumnidata2 table which holds my ex-student information during my time in the school a few years back.
 But before that do not forget to set the database that we are going to use in .../protected/config/main.php,  in my case I use database named alumni


Now choose Model Generator and enter the information required and then click Preview button and then Generate button.


After you click Preview button, the following will be displayed:


After you click Generate button, the following will be displayed:

Now I will create the CRUD code as I going to manipulate the alumnidata2 data.Choose Grud Generator and the following page will be displayed:


Click Preview button and then Generate button and the following will be displayed:


After you click Generate button the following page will be displayed:


Now I will access the CRUD page by clicking the "You may try it now"..and the following page will be displayed where the page will list down all the alumni data from the alumnidata2 table


To create a new data, click Create Alumnidata2 at the upper right corner of the page and we will be directed to the login page as shown below:


Fill the username and password field. The default value will be admin for both username and password.
After login you will be redirected to the following page and then we can begin to key in the data so that it will be inserted into the alumnidata2 table.


The login as the administrator, we can click at the Manage Alumnidata2 situated at the upper right corner of the page and this page will be displayed:


We can manipulate all the data of the Alumnidata2 at this page.
Now I come to the end of this Yii application development and what I can say is that I do not have to write any codes for the above application :)


Wednesday, February 22, 2012

My First Application in Yii Part 2

Now, we go into serious matter in Yii, and I would like to create the simplest application as described in the Yii website tutorial. I going to use Yiic.php at the command prompt to create my first application named azmipelahtest in the C:\xampp\htdocs and shown as follows:



As shown above I just typing php yiic.php webapp c:\xampp\htdocs\azmipelahtest
Now I can access my fisrt Yii application using my IE browser at http://localhost/azmipelahtest


Monday, February 20, 2012

My First Application in Yii

Yii is a PHP Framework which works similarly to CakePHP. I manage to put some effort to read and train myself using the Yii framework. When you visit the Yii websire, you will find it is very interesting that to setup Yii just take about 3 steps.


Step 1 : Create Database 
Step 2 : Auto generated Base PHP Code uisng Yiic.php 
Step 3 : Customise the codes


 In my case I'm using xampp even though I found out that the lastest version of xampp 1.7.7 has issues in windows XP Sp3. I have tried to install xampp version 1.7.7 so many times and at the apache failes to start up. So I tried the previous version of xampp 1.7.4 and finally I manage to start the apache web server and build my first Yii application.


I installing my XP Sp3 in Windows Virtual PC on top of my Windows 7 Pro. Files transfer between the host and the guest sometimes makes corrupted files. I need to use the Md5 string to make sure the my transferred files are not corrupted.


Actually at first, I'm having problem in setting up the phpmyadmin root password. I need to use the following to set the root password (PLEASE REMEMBER DO THIS FIRST BEFORE DOING ANYTHING ELSE).


C:/xampp/mysql/bin> mysqladmin -u root password NEWPASSWORD
** The above commands will set your root to have password.

However, if you want to change (or update) a root password, then you need to use the following command:
C:/xampp/mysql/bin> mysqladmin -u root -p'oldpassword' password newpassFor example, If the old password is azmi, you can set the new password to azmiabc, enter:
C:/xampp/mysql/bin> mysqladmin -u root -p'azmi' password 'azmiabc'
AND PLEASE SET YOUR CONFIC.INC.PHP to the following configuration


/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost'; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['user'] = 'root'; 
$cfg['Servers'][$i]['password'] = ''; 
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = false;


DO NOT TRY TO CHANGE YOUR ROOT PASSWORD FROM THE PHPMYADMIN USER INTERFACE SINCE THE PASSWORD SHOULD BE ENCRYTED AND CANNOT BE TYPED DIRECTLY IN THE PASSWORD FIELD UNDER THE MYSQL->USER TABLE.


I have to make sure that PHP is native to the windows environment to make sure that any PHP files can be run under DOS command prompt so I do the following under Computer ->Advance System Settings



The go to Advanced tab, select Environment Variables..



Select TMP then Path and select Edit ... as shown above


Key in in the Variable value ;c:\xampp\php then click OK and restart your PC. Then test your setting by going to the command prompt and key in php -v the result should (at least) like the following: