Download
fuelphp.com
https://github.com/downloads/fuel/fuel/fuelphp-1.4.zip
save as c:\wamp\www\
extract contents to root
http://localhost/

go to
http://localhost/public

Apache -> Apache Modules -> rewrite_module
create .htaccess or copy one
clear
add these code
SetEnv FUEL_ENV production
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /public
RewriteRule ^(/)?$ index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Ecommerce Data Model


<?php
ReplyDeleteClass Controller_Welcome extends Controller {
public function action_index() {
echo 'Hello World';
// return Response::forge('Hello World');
}
}
$view = View::forge('hello_world');
ReplyDelete$view->name='chris';
return Response::forge($view);
'tarzan', 'girl'=>'jane'));
ReplyDeletereturn Response::forge($view);
}
public function action_love($boy,$girl) {
$view = View::forge('hello_world');
$view->girl=$girl;
$view->boy=$boy;
return Response::forge($view);
}
}
'tarzan', 'girl'=>'jane'));
ReplyDeletereturn Response::forge($view);
}
public function action_love($boy,$girl) {
$view = View::forge('hello_world');
$view->girl=$girl;
$view->boy=$boy;
return Response::forge($view);
}
}
'tarzan', 'girl'=>'jane'));
ReplyDeletereturn Response::forge($view);
}
public function action_love($boy,$girl) {
$view = View::forge('hello_world');
$view->girl=$girl;
$view->boy=$boy;
return Response::forge($view);
}
}
edit c:\fuel\app\config\development\db.php
ReplyDeletereturn array(
'default' => array(
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=shop',
'username' => 'root',
'password' => '',
),
),
);
same content for c:\fuel\app\config\production\db.php
DeleteAdd ORM (/fuel/app/config/config.php)
ReplyDeletereturn array(
'always_load' => array('packages' => array('orm',)),
);
return array(
ReplyDelete'always_load' => array('packages' => array('orm',)),
);
php oil g controller classroom index view list name hello world
ReplyDeleteto check if successful:
ReplyDeletetype the url localhost/public/index.php/classroom/
http://localhost/public/index.php/classroom/
ReplyDeleteTo create the migration file:
ReplyDeletetype in the command prompt:
php oil g scaffold users username:varchar[10] password:varchar age:tinyint sex:tinyint
To migrate (i.e. have these changes be applied to the database):
Type in the command prompt:
php oil refine migrate
make sure that your config.php db.php (development and production) are correct (see previous posts)
DeleteTo add Users:
ReplyDelete1. Go to http://localhost/public/index.php/users/create
'base_url' => 'http://fuelphp.demo/public/index.php/',
ReplyDelete'base_url' => 'http://localhost/public/index.php/',
ReplyDeleteModel Name: custommodel.php
ReplyDeletenamespace Model;
use DB;
class Custommodel extends \Model {
public static function find_data($field, $value, $tablename) {
$result = DB::select('*')->from($tablename)->where($field, $value)->execute();
return $result;
}
}
Controller Name: products.php
ReplyDeleteuse \Model\Custommodel;
public function action_view($id = null)
{
$data['product'] = Custommodel::find_data('slug', $id, 'products');
$this->template->title = "Product";
$this->template->content = View::forge('admin\products/view', $data);
}