- Messages
- 298
- Reaction score
- 1
- Points
- 28
Hi Guys, matagal ko ng plano to kaso hindi ko alam kung kelan sisimulan dahil sa sobrang ka busyhan pero ngayon hayaan nyo akong simulan tong plano ko na to ang tutorial about CakePHP.
PART I (Setting Up CakePHP)
What is CakePHP? Why Use it?
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.
CakePHP takes the monotony out of web development. We provide you with all the tools you need to get started coding what you really need to get done: the logic specific to your application. Instead of reinventing the wheel every time you sit down to a new project, check out a copy of CakePHP and get started with the real guts of your application.
CakePHP has an active developer team and community, bringing great value to the project. In addition to keeping you from wheel-reinventing, using CakePHP means your application’s core is well tested and is being constantly improved.
Here’s a quick list of features you’ll enjoy when using CakePHP:
- Active, friendly community
- Flexible licensing
- Compatible with versions 4 and 5 of PHP
- Integrated CRUD for database interaction
- Application scaffolding
- Code generation
- MVC architecture
- Request dispatcher with clean, custom URLs and routes
- Built-in validation
- Fast and flexible templating (PHP syntax, with helpers)
- View Helpers for AJAX, JavaScript, HTML Forms and more
- Email, Cookie, Security, Session, and Request Handling
- Components
- Flexible ACL
- Data Sanitization
- Flexible Caching
- Localization
- Works from any web site directory, with little to no Apache configuration involved
So ngayon may idea na kayo kung ano ba ang CakePHP, ang kailangan naman ngayon gawin ay idownload ang CakePHP. CakePHP 2.3.2 Download Link
After download just extract the .zip file to your web directory (sa htdocs if you are using xampp). Rename the extracted CakePHP sa kahit anung name ng website or webapp na gusto mu. (NOTE: si CakePHP na mismo ang gagalawin mu to make a web app).
then open your favorite web browser (kahit anung web browser depende kung anung trip mu) type in to your url bar localhost/name_of_your_extracted_cakephp
pag na open mu yan dapat may warning yan
yung parang ganito
pag nakita nyu yan all you have to do is
name_of_your_extracted_cakephp\app\Config
then open core.php
you should change the value of Security.salt & Security.cipherSeed
kung di ako nag kakamali nasa line 203 & 208
sundin nyu yung comment sa taas nun parang ganito
Code:
/**
* A random string used in security hashing methods.
*/
Configure::write('Security.salt', 'sadfhkjashdfjh3845y7834678ywefrhshfasfasfu3h487rjkhdjashFJHSDFH89W');
/**
* A random numeric string (digits only) used to encrypt/decrypt strings.
*/
Configure::write('Security.cipherSeed', '4718768768768740848464068476976786786768');
after that balik ulit kayo sa
name_of_your_extracted_cakephp\app\Config
makikita nyu jan dapat yung database.php.default
so what you need to do is no rename the database.php.default to database.php then edit the database.php
Code:
/**
* This is core configuration file.
*
* Use it to configure core behaviour of Cake.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.Config
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* Database configuration class.
* You can specify multiple configurations for production, development and testing.
*
* datasource => The name of a supported datasource; valid options are as follows:
* Database/Mysql - MySQL 4 & 5,
* Database/Sqlite - SQLite (PHP5 only),
* Database/Postgres - PostgreSQL 7 and higher,
* Database/Sqlserver - Microsoft SQL Server 2005 and higher
*
* You can add custom database datasources (or override existing datasources) by adding the
* appropriate file to app/Model/Datasource/Database. Datasources should be named 'MyDatasource.php',
*
*
* persistent => true / false
* Determines whether or not the database should use a persistent connection
*
* host =>
* the host you connect to the database. To add a socket or port number, use 'port' => #
*
* prefix =>
* Uses the given prefix for all the tables in this database. This setting can be overridden
* on a per-table basis with the Model::$tablePrefix property.
*
* schema =>
* For Postgres/Sqlserver specifies which schema you would like to use the tables in. Postgres defaults to 'public'. For Sqlserver, it defaults to empty and use
* the connected user's default schema (typically 'dbo').
*
* encoding =>
* For MySQL, Postgres specifies the character encoding to use when connecting to the
* database. Uses database default not specified.
*
* unix_socket =>
* For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
*/
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'database_name',
'prefix' => '',
//'encoding' => 'utf8',
);
public $test = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'prefix' => '',
//'encoding' => 'utf8',
);
}
ang gagalawin nyu lang jan is yung $default ok? supply it by the database na gagamitin and you should see like this
pag ok na lahat Congrats! Marunong ka na magsetup ng CakePHP
so hintay lang sa susunod na tuts mga ka-SB and Happy Baking
NOTE : Don't be confused sa mga screenshot ha? kuha ko lng sa web yan gusto ko lng maipakita yung mga CakePHP warning
Last edited: