This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#/app/Controller/BooksController.php | |
class BooksController extends AppController{ | |
public $scaffold; //attiviamo lo scaffold per poter procedere al CRUD di cakephp | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#/app/Model/Book.php | |
class Book extends AppModel { | |
public $name = 'Book'; | |
public $displayField ='title'; | |
//definizione della relazione con altro modello | |
public $belongsTo = array('Author'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//esempio senza pass | |
Router::connect( | |
'/controller001/:id', | |
array('action' => 'view'), | |
array('id' => '[0-9]+') | |
); | |
//esempio con pass | |
Router::connect( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//url /blog/3_articolo-di-esempio | |
Router::connect( | |
'blog/:id_:slug', | |
array( | |
'controller' => 'posts', | |
'action' => 'view' | |
), | |
array( | |
'pass' => array('id'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//url /hobbies/10/roma | |
Router::connect( | |
'hobbies/:id/:city', | |
array( | |
'controller' => 'hobbies', | |
'action' => 'search' | |
), | |
array( | |
'pass' => array('id', 'city'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Router::connect( | |
'/:controller/:id', | |
array('action' => 'view'), | |
array('id' => '[0-9]+') | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Router::connect('/:action', array('controller' => 'home')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Router::connect( | |
'/:controller/:year/:month/:day', | |
array('action' => 'index'), | |
array( | |
'year' => '[12][0-9]{3}', | |
'month' => '0[1-9]|1[012]', | |
'day' => '0[1-9]|[12][0-9]|3[01]' | |
) | |
); |