CakePHP docs
| Id/Actions | Category | Code Examples | Links | Remarks |
|---|---|---|---|---|
| 2 View |
A menu item for CakePHP? | |||
| 3 View |
Search Functionality | It is working on individual models (or tables). | ||
| 4 View |
User Login and Register System | Need to work on it. | ||
| 30 View |
php function - get_defined_vars() for debugging | After working my way through various debugging techniques, I pulled out the big gun. In my view, I dumped the output of PHP's get_defined_vars() function and found that my $vendor_type variable had been renamed to $vendorType after the following line in controller: $this->set ( compact ( 'vendor_type', 'application_type', 'states' ) ); |
||
| 63 View |
HTML helper functions - addCrumb and getCrumbs | $html->addCrumb() and $html->getCrumbs functions render breadcrumbs (for example, home->about->mailing address). addCrumb( name[string], link[mixed], attributes[array] ) getCrumbs( separator[string], startText[string] ) |
||
| 24 View |
CakePHP functions - redirect | $this->redirect(array('action'=>'index'));
When needing to launch another action with its views and
everything else, use the redirect() function instead of
requestAction().
=> In short, the redirect() function causes another browser
request and changes the URL, while requestAction() works
internally to launch specific actions. |
||
| 33 View |
form helpers in view - create, input, end | <?=$form->create('Posts');?>
<?=$form->input('name');?>
<?=$form->input('content',
array('type'=>'textarea','rows'=>4,'cols'=>40));?>
<?=$form->end('Submit');?> |
||
| 64 View |
form helpers - submit | <?=$form->submit('Submit',array('onSubmit'=>'return false;'));?>
will return a submit button containing the onSubmit attribute, like so:
<input type="submit" value="Submit" onSubmit="return false;" /> |
||
| 18 View |
Helpers - css link | <?php echo $html->css('styles');?>
will produce:
<link rel="stylesheet" type="text/css" href="/css/styles.css" />
=> The css files should be stored under webroot/css folder. |
||
| 14 View |
Layouts | => a layout file to be used by the entire application or one controller action at a time. => Layouts are stored in the app/views/layouts directory and contain presentation output like views and elements. They perform minimal logic and mainly serve to wrap HTML around changing views. =>A layout's file name can be anything but must be lowercase and have the .ctp extension. |
||
| 5 View |
Naming Conventions - Controller | => controller name must match to a database table name; => If you decide to create controllers with names other than tables of the database, you should actually not create a controller but use a component instead. => The names of database tables as well as controllers are lowercase and in plural form. => example: orders table will have a controller php file name orders_controller.php under app/controllers folder. The controller class will follow OrdersController convention (CamelCased). |
||
| 8 View |
Naming Conventions - table name with more than one word | => For example, table name is special_orders; => then the controller file should be special_orders_controller.php under app/controllers folder; => the controller class name should be SpecialOrdersController app/controllers/special_orders_controller.php file; => the model file name should be special_order.php under app/models folder. The model class should be SpecialOrder in app/models/special_order.php file. => The view name should be the same name as an action defined in its controller under app/views/<controller_name> folder. |
||
| 6 View |
Naming Conventions - Model | => for orders table, the model file name under app/models directory would be orders.php. The class name would be Order extends AppModel. |
||
| 7 View |
Naming Conventions - View | => The view name will be the same as actions defined in controller. Suppose that there is an action called add (function add()), then there will be a view called add under app/views/<controller>/add.ctp. |
||
| 15 View |
Behaviors | => When interacting with the database, sometimes the model will
need to perform more complex processes than simply CRUD
functionality. In some applications, deleting a record will require
performing other manipulations to other tables and records,
and so on, with other database operations. Cake resolves this issue
with behaviors, which are classes that may be called by models when
performing model functions.
=> Behaviors are stored in the app/models/behaviors directory and
can be named anything following the same rules for naming helper
files and components. They must have the .php extension.
=> In the file, behavior class names are set with the following
syntax:
class SpecialBehavior extends ModelBehavior {}
=> By using behaviors to store complex or customized model
operations, you give the application's models more consistency. |
Page 1 of 6, showing 15 records out of 79 total, starting on record 1, ending on 15
