-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
Marwen Hlaoui edited this page Aug 28, 2015
·
1 revision
https://github.com/marvision-framework/beta marvision
then go to : app/config/parameters.yml and add your web site setting for localhost if working in localhost or the parameters of your official host like :
parameters_host:
db_host: #database host here
db_name: #db name
db_user: #db user id
db_password: #db passnext go to : web/model/
and create your database model ...
touch Post.php
Note: The first letter is lowercase
add your validation function:
<?php
class Post extends Model
{
##### validation of post (example)
var $validate = array(
'slug' => array(
'rule' => '([a-z0-9\-]+)',
'message' => "L'url n'est pas valide"
)
);
.....add your database table content :
.....
# @ posts.id is default
# @ posts.slug
#########################
"slug" => array(
"type" => "VARCHAR",
"size" => "20"
),
# @ posts.title
#########################
"title" => array(
"type" => "VARCHAR"
),
.....and now you go to create your controller : web/controller/
touch PagesController.php
class PagesController extends Controller
{
....
}function home(){
$this->layout = 'default'; ///your layout used in this page
$d['thisongl'] = 'home'; ///page title
$this->loadModel('Post'); /// the model loadet inthis page
$this->set($d); ///send to view
}and next step go to create your layout or page template : web/view/layout/
like : web/view/layout/default.php
<?php echo $this->Session->flash(); ?>
<?php echo $content_for_layout; ?>use HTML,CSS and Javascrip,....
finally go to create your page view : web/view/
like : /web/view/pages/home.php
<h1>Home page</h1>and we can use routing system : app/config/routing.php
Router::connect('','pages/home');//home page