Welcome,
In this blog we will learn to create Hello world program
CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. Our primary goal is to enable you to work in a structured and rapid manner–without loss of flexibility.
Installation
Go to www.cakephp.org and click download.
After dowloading copy that file cakephp to C:/xampp/htdocs
Now go to new tab and type localhost/cakephp you can see cakePHP downladed to your localhost.
To better understand refer this site http://www.youtube.com/watch?v=nO9oSQhRa9s
Connect to database
Go to C:/xampp/htdocs/cakephp/app/config
Here you can find a file called database.default.php file rename it as database.php file and open it with edit with notepad and change user name and password as per your local site name....in general user is root....password can be anything...
Go to localhost/cakephp now you can see cake connected to database if it is so you can start writing your first program hello world.
go to mysql
Enter password:****
create a table called post for that
first type show mysql;
then type
Write the program
cakePHP uses MVC model. so for writing any program first you have to create model,view and controller.
first Go to C:/xampp/htdocs/cakephp/app/model
Open new file here and write the following program<?php
class Post extends AppModel{
var $name='post';
}
?>
In this blog we will learn to create Hello world program
CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. Our primary goal is to enable you to work in a structured and rapid manner–without loss of flexibility.
STEPS1.Install2.Connect to database3.Write the program
Installation
Go to www.cakephp.org and click download.
After dowloading copy that file cakephp to C:/xampp/htdocs
Now go to new tab and type localhost/cakephp you can see cakePHP downladed to your localhost.
To better understand refer this site http://www.youtube.com/watch?v=nO9oSQhRa9s
Connect to database
Go to C:/xampp/htdocs/cakephp/app/config
Here you can find a file called database.default.php file rename it as database.php file and open it with edit with notepad and change user name and password as per your local site name....in general user is root....password can be anything...
Go to localhost/cakephp now you can see cake connected to database if it is so you can start writing your first program hello world.
go to mysql
Enter password:****
create a table called post for that
first type show mysql;
then type
CREATE TABLE posts ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50), body TEXT, created DATETIME DEFAULT NULL, modified DATETIME DEFAULT NULL );
Write the program
For better understanding u can go to site
cakePHP uses MVC model. so for writing any program first you have to create model,view and controller.
first Go to C:/xampp/htdocs/cakephp/app/model
Open new file here and write the following program<?php
class Post extends AppModel{
var $name='post';
}
?>
and save this file as post.php
secondly Go to C:/xampp/htdocs/cakephp/app/controller
Open new file here and write the following program
<?php
class PostsController extends AppController {
var $name ='posts';
function hello_world(){
}
}
?>
and save this file as posts_controller.php
thirdly
Go to C:/xampp/htdocs/cakephp/app/view
Here create your new folder called posts and open new file into that
and write the following program
<h2>welcome to maisa</h2>
</h2>hello world</h2>
<p>this is my 1st program</p>
and save this file as hello_world.ctp
After ur done with all the programs run the program go to new tab type
localhost/cakephp/posts/hello_world
Output looks like something like this
welcome to maisa
hello world
this is my 1st program
Nr | Query | Error | Affected | Num. rows | Took (ms) |
---|---|---|---|---|---|
1 | SHOW FULL COLUMNS FROM `posts` | 5 | 5 | 5 | |
2 | SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME= 'latin1_swedish_ci'; | 1 | 1 | 1 |
No comments:
Post a Comment