Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Kill more newlines.

  • Loading branch information...
commit 6fe149d41c5a2b8030e685384bceacd4b7445e75 1 parent f75866c
@markstory markstory authored
Showing with 13 additions and 300 deletions.
  1. +1 −1  en/cakephp-overview.rst
  2. +1 −1  en/contributing.rst
  3. +1 −1  en/core-libraries/components/email.rst
  4. +0 −3  en/core-libraries/components/sessions.rst
  5. +1 −5 en/core-libraries/helpers/cache.rst
  6. +0 −74 en/core-libraries/helpers/form.rst
  7. +0 −42 en/core-libraries/helpers/html.rst
  8. +1 −34 en/core-libraries/helpers/js.rst
  9. +1 −1  en/core-libraries/helpers/number.rst
  10. +0 −23 en/core-libraries/helpers/paginator.rst
  11. +0 −7 en/core-libraries/helpers/rss.rst
  12. +0 −4 en/core-libraries/helpers/session.rst
  13. +0 −1  en/core-libraries/helpers/text.rst
  14. +1 −2  en/core-libraries/helpers/time.rst
  15. +1 −1  en/deployment.rst
  16. +0 −1  en/installation.rst
  17. +0 −3  en/models.rst
  18. +1 −7 en/models/data-validation/validating-data-from-the-controller.rst
  19. +1 −16 en/plugins.rst
  20. +1 −1  en/tutorials-and-examples.rst
  21. +0 −11 en/tutorials-and-examples/blog-auth-example/auth.rst
  22. +0 −3  en/tutorials-and-examples/blog/blog.rst
  23. +0 −12 en/tutorials-and-examples/blog/part-two.rst
  24. +1 −9 en/tutorials-and-examples/simple-acl-controlled-application/part-two.rst
  25. +0 −10 en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.rst
  26. +1 −27 en/views.rst
View
2  en/cakephp-overview.rst
@@ -21,4 +21,4 @@ used in context.
.. meta::
:title lang=en: CakePHP Overview
- :keywords lang=en: web application framework,model view controller,object oriented programming,piece of cake,cookbook,functionality,xml,cakephp
+ :keywords lang=en: web application framework,model view controller,object oriented programming,piece of cake,cookbook,functionality,xml,cakephp
View
2  en/contributing.rst
@@ -16,4 +16,4 @@ cover the various ways you can contribute to CakePHP:
.. meta::
:title lang=en: Contributing
- :keywords lang=en: coding conventions,documentation,maxdepth
+ :keywords lang=en: coding conventions,documentation,maxdepth
View
2  en/core-libraries/components/email.rst
@@ -49,4 +49,4 @@ documentation.
.. meta::
:title lang=en: EmailComponent
- :keywords lang=en: component subject,component delivery,php class,template layout,custom headers,template method,filenames,alias,lib,array,email,migration,attachments,elements,sun
+ :keywords lang=en: component subject,component delivery,php class,template layout,custom headers,template method,filenames,alias,lib,array,email,migration,attachments,elements,sun
View
3  en/core-libraries/components/sessions.rst
@@ -98,7 +98,6 @@ Creating notification messages
This will create a one-time message that can be displayed to the user,
using the SessionHelper::
- <?php
// In the view.
echo $this->Session->flash();
@@ -142,7 +141,6 @@ Creating notification messages
example adding "class" in the $params array will apply a class to the
``div`` output using ``$this->Session->flash()`` in your layout or view.::
- <?php
$this->Session->setFlash('Example message text', 'default', array('class' => 'example_class'));
The output from using ``$this->Session->flash()`` with the above example
@@ -153,7 +151,6 @@ Creating notification messages
To use an element from a plugin just specify the plugin in the
``$params``::
- <?php
// Will use /app/Plugin/Comment/View/Elements/flash_no_spam.ctp
$this->Session->setFlash('Message!', 'flash_no_spam', array('plugin' => 'Comment'));
View
6 en/core-libraries/helpers/cache.rst
@@ -29,7 +29,6 @@ files when handling requests.
Once you've uncommented the ``Cache.check`` line you will need to add the helper
to your controller's ``$helpers`` array::
- <?php
class PostsController extends AppController {
public $helpers = array('Cache');
}
@@ -47,7 +46,6 @@ expressed in a ``strtotime()`` format. (ie. "1 hour", or "3 minutes").
Using the example of an ArticlesController, that receives a lot of
traffic that needs to be cached::
- <?php
public $cacheAction = array(
'view' => 36000,
'index' => 48000
@@ -57,14 +55,12 @@ This will cache the view action 10 hours, and the index action 13 hours. By
making ``$cacheAction`` a ``strtotime()`` friendly value you can cache every action in the
controller::
- <?php
public $cacheAction = "1 hour";
You can also enable controller/component callbacks for cached views
created with ``CacheHelper``. To do so you must use the array
format for ``$cacheAction`` and create an array like the following::
- <?php
public $cacheAction = array(
'view' => array('callbacks' => true, 'duration' => 21600),
'add' => array('callbacks' => true, 'duration' => 36000),
@@ -139,4 +135,4 @@ cached view files. If you need to clear the cached view files, use
.. meta::
:title lang=en: CacheHelper
:description lang=en: The Cache helper assists in caching entire layouts and views, saving time repetitively retrieving data.
- :keywords lang=en: cache helper,view caching,cache action,cakephp cache,nocache,clear cache
+ :keywords lang=en: cache helper,view caching,cache action,cakephp cache,nocache,clear cache
View
74 en/core-libraries/helpers/form.rst
@@ -64,7 +64,6 @@ opening form tag.
http://site.com/recipes/edit/5, we would get the following::
// Controller/RecipesController.php:
- <?php
public function edit($id = null) {
if (empty($this->request->data)) {
$this->request->data = $this->Recipe->findById($id);
@@ -91,7 +90,6 @@ opening form tag.
:term:`plugin syntax` when creating a form. This will ensure the form is
correctly generated::
- <?php
echo $this->Form->create('ContactManager.Contact');
The ``$options`` array is where most of the form configuration
@@ -156,7 +154,6 @@ There are a number of options for create():
the $options array. The supplied URL can be relative to your CakePHP
application::
- <?php
echo $this->Form->create(null, array('url' => '/recipes/add'));
// or
echo $this->Form->create(null, array(
@@ -169,7 +166,6 @@ There are a number of options for create():
or can point to an external domain::
- <?php
echo $this->Form->create(null, array(
'url' => 'http://www.google.com/search',
'type' => 'get'
@@ -192,7 +188,6 @@ There are a number of options for create():
``input()`` with the ``inputDefaults`` key to customize your default input
creation::
- <?php
echo $this->Form->create('User', array(
'inputDefaults' => array(
'label' => false,
@@ -204,7 +199,6 @@ There are a number of options for create():
options declared in inputDefaults. You can override the
defaultOptions by declaring the option in the input() call::
- <?php
echo $this->Form->input('password'); // No div, no label
echo $this->Form->input('username', array('label' => 'Username')); // has a label element
@@ -239,7 +233,6 @@ Closing the Form
You can specify detail settings by passing an array to ``end()``::
- <?php
$options = array(
'label' => 'Update',
'div' => array(
@@ -311,7 +304,6 @@ field. Internally ``input()`` delegates to other methods in FormHelper.
quote (text). You can use the input() method of the FormHelper to
create appropriate inputs for all of these form fields::
- <?php
echo $this->Form->create();
echo $this->Form->input('username'); //text
@@ -323,7 +315,6 @@ field. Internally ``input()`` delegates to other methods in FormHelper.
A more extensive example showing some options for a date field::
- <?php
echo $this->Form->input('birth_dt', array(
'label' => 'Date of birth',
'dateFormat' => 'DMY',
@@ -341,32 +332,27 @@ field. Internally ``input()`` delegates to other methods in FormHelper.
-> extraFunkyModels) with the select options. In the controller action you
would put the following::
- <?php
$this->set('groups', $this->User->Group->find('list'));
And in the view a multiple select can be created with this simple
code::
- <?php
echo $this->Form->input('Group');
If you want to create a select field while using a belongsTo - or
hasOne - Relation, you can add the following to your Users-controller
(assuming your User belongsTo Group)::
- <?php
$this->set('groups', $this->User->Group->find('list'));
Afterwards, add the following to your form-view::
- <?php
echo $this->Form->input('group_id');
If your model name consists of two or more words, e.g.,
"UserGroup", when passing the data using set() you should name your
data in a pluralised and camelCased format as follows::
- <?php
$this->set('userGroups', $this->UserGroup->find('list'));
// or
$this->set('reallyInappropriateModelNames', $this->ReallyInappropriateModelName->find('list'));
@@ -387,7 +373,6 @@ field. Internally ``input()`` delegates to other methods in FormHelper.
Would generate an input set with a custom legend. You can customize
individual inputs through ``$fields`` as well.::
- <?php
echo $form->inputs(array(
'name' => array('label' => 'custom label')
));
@@ -413,14 +398,12 @@ This allows you to omit the model name when generating inputs for the model that
the form was created for. You can create inputs for associated models, or
arbitrary models by passing in Modelname.fieldname as the first parameter::
- <?php
echo $this->Form->input('Modelname.fieldname');
If you need to specify multiple fields using the same field name,
thus creating an array that can be saved in one shot with
saveAll(), use the following convention::
- <?php
echo $this->Form->input('Modelname.0.fieldname');
echo $this->Form->input('Modelname.1.fieldname');
@@ -435,7 +418,6 @@ If you are using fields named ``year``, ``month``, ``day``, ``hour``,
``minute``, or ``meridian`` and having issues getting the correct input, you can
set the ``name`` attribute to override the default behavior::
- <?php
echo $this->Form->input('Model.year', array(
'type' => 'text',
'name' => 'data[Model][year]'
@@ -455,7 +437,6 @@ html attributes. The following will cover the options specific to
the :ref:`automagic-form-elements`, you can also create 'file', 'password',
and any type supported by HTML5::
- <?php
echo $this->Form->input('field', array('type' => 'file'));
echo $this->Form->input('email', array('type' => 'email'));
@@ -477,7 +458,6 @@ html attributes. The following will cover the options specific to
Setting the class name::
- <?php
echo $this->Form->input('User.name', array(
'div' => 'class_name'
));
@@ -491,7 +471,6 @@ html attributes. The following will cover the options specific to
Setting multiple attributes::
- <?php
echo $this->Form->input('User.name', array(
'div' => array(
'id' => 'mainDiv',
@@ -509,7 +488,6 @@ html attributes. The following will cover the options specific to
Disabling div output::
- <?php
echo $this->Form->input('User.name', array('div' => false)); ?>
Output::
@@ -520,7 +498,6 @@ html attributes. The following will cover the options specific to
* ``$options['label']`` Set this key to the string you would like to be
displayed within the label that usually accompanies the input::
- <?php
echo $this->Form->input('User.name', array(
'label' => 'The User Alias'
));
@@ -535,7 +512,6 @@ html attributes. The following will cover the options specific to
Alternatively, set this key to false to disable the output of the
label::
- <?php
echo $this->Form->input('User.name', array('label' => false));
Output::
@@ -548,7 +524,6 @@ html attributes. The following will cover the options specific to
``label`` element. If you do this, you can use a ``text`` key in
the array to customize the label text::
- <?php
echo $this->Form->input('User.name', array(
'label' => array(
'class' => 'thingy',
@@ -571,13 +546,11 @@ html attributes. The following will cover the options specific to
To disable error message output set the error key to false::
- <?php
$this->Form->input('Model.field', array('error' => false));
To modify the wrapping element type and its class, use the
following format::
- <?php
$this->Form->input('Model.field', array(
'error' => array('attributes' => array('wrap' => 'span', 'class' => 'bzzz'))
));
@@ -585,7 +558,6 @@ html attributes. The following will cover the options specific to
To prevent HTML being automatically escaped in the error message
output, set the escape suboption to false::
- <?php
$this->Form->input('Model.field', array(
'error' => array(
'attributes' => array('escape' => false)
@@ -595,7 +567,6 @@ html attributes. The following will cover the options specific to
To override the model error messages use an array with
the keys matching the validation rule names::
- <?php
$this->Form->input('Model.field', array(
'error' => array('tooShort' => __('This is not long enough'))
));
@@ -610,7 +581,6 @@ html attributes. The following will cover the options specific to
Use these keys if you need to inject some markup inside the output
of the input() method::
- <?php
echo $this->Form->input('field', array(
'before' => '--before--',
'after' => '--after--',
@@ -630,7 +600,6 @@ html attributes. The following will cover the options specific to
For radio inputs the 'separator' attribute can be used to
inject markup to separate each input/label pair::
- <?php
echo $this->Form->input('field', array(
'before' => '--before--',
'after' => '--after--',
@@ -666,7 +635,6 @@ html attributes. The following will cover the options specific to
* ``$options['inputDefaults']`` If you find yourself repeating the same options
in multiple input() calls, you can use `inputDefaults`` to keep your code dry::
- <?php
echo $this->Form->create('User', array(
'inputDefaults' => array(
'label' => false,
@@ -678,7 +646,6 @@ html attributes. The following will cover the options specific to
options declared in inputDefaults. You can override the
defaultOptions by declaring the option in the input() call::
- <?php
// No div, no label
echo $this->Form->input('password');
@@ -708,7 +675,6 @@ common options shared by all input methods are as follows:
* ``$options['class']`` You can set the classname for an input::
- <?php
echo $this->Form->input('title', array('class' => 'custom-class'));
* ``$options['id']`` Set this key to force the value of the DOM id for the input.
@@ -719,13 +685,11 @@ common options shared by all input methods are as follows:
Example usage::
- <?php
echo $this->Form->input('ingredient', array('default' => 'Sugar'));
Example with select field (Size "Medium" will be selected as
default)::
- <?php
$sizes = array('s' => 'Small', 'm' => 'Medium', 'l' => 'Large');
echo $this->Form->input('size', array('options' => $sizes, 'default' => 'm'));
@@ -759,7 +723,6 @@ Options for select, checkbox and radio inputs
For types select, date, time, datetime). Set ‘selected’ to the value of the
item you wish to be selected by default when the input is rendered::
- <?php
echo $this->Form->input('close_time', array(
'type' => 'time',
'selected' => '13:30:00'
@@ -777,7 +740,6 @@ Options for select, checkbox and radio inputs
value with text displayed instead of just a blank option, pass in a
string to empty::
- <?php
echo $this->Form->input('field', array(
'options' => array(1, 2, 3, 4, 5),
'empty' => '(choose one)'
@@ -813,7 +775,6 @@ Options for select, checkbox and radio inputs
This can be disabled by setting the ``$options['hiddenField'] = false``::
- <?php
echo $this->Form->checkbox('published', array('hiddenField' => false));
Which outputs::
@@ -851,7 +812,6 @@ Options for select, checkbox and radio inputs
You can set a different hidden field value other than 0 such as 'N'::
- <?php
echo $this->Form->checkbox('published', array(
'value' => 'Y',
'hiddenField' => 'N',
@@ -879,7 +839,6 @@ Datetime options
* ``$options['interval']`` This option specifies the number of minutes between
each option in the minutes select box::
- <?php
echo $this->Form->input('Model.time', array(
'type' => 'time',
'interval' => 15
@@ -897,7 +856,6 @@ Form Element-Specific Methods
DOM id. If ``$text`` is undefined, ``$fieldName`` will be used to inflect
the label's text::
- <?php
echo $this->Form->label('User.name');
echo $this->Form->label('User.name', 'Your username');
@@ -909,7 +867,6 @@ Form Element-Specific Methods
``$options`` can either be an array of html attributes, or a string that
will be used as a classname::
- <?php
echo $this->Form->label('User.name', null, array('id' => 'user-label'));
echo $this->Form->label('User.name', 'Your username', 'highlight');
@@ -936,7 +893,6 @@ Form Element-Specific Methods
Creates a password field.::
- <?php
echo $this->Form->password('password');
Will output::
@@ -947,7 +903,6 @@ Form Element-Specific Methods
Creates a hidden form input. Example::
- <?php
echo $this->Form->hidden('id');
Will output::
@@ -963,7 +918,6 @@ Form Element-Specific Methods
Creates a textarea input field.::
- <?php
echo $this->Form->textarea('notes');
Will output::
@@ -978,7 +932,6 @@ Form Element-Specific Methods
::
- <?php
echo $this->Form->textarea('notes', array('escape' => false);
// OR....
echo $this->Form->input('notes', array('type' => 'textarea', 'escape' => false);
@@ -992,7 +945,6 @@ Form Element-Specific Methods
* ``$options['rows'], $options['cols']`` These two keys specify the number of
rows and columns::
- <?php
echo $this->Form->textarea('textarea', array('rows' => '5', 'cols' => '5'));
Output::
@@ -1053,7 +1005,6 @@ Form Element-Specific Methods
fieldset by default. Set ``$attributes['legend']`` to false to remove
them.::
- <?php
$options = array('M' => 'Male', 'F' => 'Female');
$attributes = array('legend' => false);
echo $this->Form->radio('gender', $options, $attributes);
@@ -1081,7 +1032,6 @@ Form Element-Specific Methods
default. Set to false the the 'empty' key in the ``$attributes`` variable
to turn off the default empty option::
- <?php
$options = array('M' => 'Male', 'F' => 'Female');
echo $this->Form->select('gender', $options);
@@ -1098,7 +1048,6 @@ Form Element-Specific Methods
whether to HTML entity encode the contents of the select options.
Defaults to true::
- <?php
$options = array('M' => 'Male', 'F' => 'Female');
echo $this->Form->select('gender', $options, array('escape' => false));
@@ -1106,7 +1055,6 @@ Form Element-Specific Methods
select input, or for a radio group. Unless the 'type' is specified as 'radio',
the FormHelper will assume that the target output is a select input::
- <?php
echo $this->Form->select('field', array(1,2,3,4,5));
Output::
@@ -1121,7 +1069,6 @@ Form Element-Specific Methods
Options can also be supplied as key-value pairs::
- <?php
echo $this->Form->select('field', array(
'Value 1' => 'Label 1',
'Value 2' => 'Label 2',
@@ -1140,7 +1087,6 @@ Form Element-Specific Methods
data in hierarchical format. This works on multiple checkboxes and radio
buttons too, but instead of optgroups wraps elements in fieldsets::
- <?php
$options = array(
'Group 1' => array(
'Value 1' => 'Label 1',
@@ -1167,13 +1113,11 @@ Form Element-Specific Methods
* ``$options['multiple']`` If 'multiple' has been set to true for an input that
outputs a select, the select will allow multiple selections::
- <?php
echo $this->Form->select('Model.field', $options, array('multiple' => true));
Alternatively set 'multiple' to 'checkbox' to output a list of
related check boxes::
- <?php
$options = array(
'Value 1' => 'Label 1',
'Value 2' => 'Label 2'
@@ -1201,7 +1145,6 @@ Form Element-Specific Methods
to disable all or some checkboxes. To disable all checkboxes set disabled
to ``true``::
- <?php
$options = array(
'Value 1' => 'Label 1',
'Value 2' => 'Label 2'
@@ -1235,14 +1178,12 @@ Form Element-Specific Methods
the form enctype is set to "multipart/form-data", so start off with
a create function such as the following::
- <?php
echo $this->Form->create('Document', array('enctype' => 'multipart/form-data'));
// OR
echo $this->Form->create('Document', array('type' => 'file'));
Next add either of the two lines to your form view file::
- <?php
echo $this->Form->input('Document.submittedfile', array(
'between' => '<br />',
'type' => 'file'
@@ -1264,7 +1205,6 @@ Form Element-Specific Methods
server. 'tmp\_name' will have a different path in a Unix
environment::
- <?php
$this->request->data['Document']['submittedfile'] = array(
'name' => 'conference_schedule.pdf',
'type' => 'application/pdf',
@@ -1283,7 +1223,6 @@ Validating Uploads
Below is an example validation method you could define in your
model to validate whether a file has been successfully uploaded::
- <?php
public function isUploadedFile($params) {
$val = array_shift($params);
if ((isset($val['error']) && $val['error'] == 0) ||
@@ -1296,7 +1235,6 @@ model to validate whether a file has been successfully uploaded::
Creates a file input::
- <?php
echo $this->Form->create('User', array('type' => 'file'));
echo $this->Form->file('avatar');
@@ -1324,7 +1262,6 @@ Creating buttons and submit elements
It is enclosed between ``div`` tags by default; you can avoid this
by declaring ``$options['div'] = false``::
- <?php
echo $this->Form->submit();
Will output::
@@ -1334,7 +1271,6 @@ Creating buttons and submit elements
You can also pass a relative or absolute url to an image for the
caption parameter instead of caption text.::
- <?php
echo $this->Form->submit('ok.png');
Will output::
@@ -1354,7 +1290,6 @@ Creating buttons and submit elements
::
- <?php
echo $this->Form->button('A Button');
echo $this->Form->button('Another Button', array('type' => 'button'));
echo $this->Form->button('Reset the Form', array('type' => 'reset'));
@@ -1372,7 +1307,6 @@ Creating buttons and submit elements
bool and determines whether to HTML entity encode the $title of the button.
Defaults to false::
- <?php
echo $this->Form->button('Submit Form', array('type' => 'submit', 'escape' => true));
.. php:method:: postButton(string $title, mixed $url, array $options = array ())
@@ -1417,7 +1351,6 @@ Creating date and time inputs
``$attributes['empty']`` is false, the select will not include an
empty option::
- <?php
echo $this->Form->year('purchased', 2000, date('Y'));
Will output::
@@ -1440,7 +1373,6 @@ Creating date and time inputs
Creates a select element populated with month names::
- <?php
echo $this->Form->month('mob');
Will output::
@@ -1466,7 +1398,6 @@ Creating date and time inputs
passing false. (Note: the default months are internationalized and
can be translated using localization.)::
- <?php
echo $this->Form->month('mob', null, array('monthNames' => false));
.. php:method:: day(string $fieldName, array $attributes)
@@ -1478,7 +1409,6 @@ Creating date and time inputs
the first option is 'Day'), you can supply the text as the final
parameter as follows::
- <?php
echo $this->Form->day('created');
Will output::
@@ -1526,7 +1456,6 @@ Displaying and checking errors
Returns true if the supplied $fieldName has an active validation
error.::
- <?php
if ($this->Form->isFieldError('gender')) {
echo $this->Form->error('gender');
}
@@ -1550,7 +1479,6 @@ You can declare a set of default options for ``input()`` using
:php:meth:`FormHelper::inputDefaults()`. Changing the default options allows
you to consolidate repeated options into a single method call::
- <?php
echo $this->Form->inputDefaults(array(
'label' => false,
'div' => false,
@@ -1562,7 +1490,6 @@ All inputs created from that point forward will inherit the options declared in
inputDefaults. You can override the default options by declaring the option in the
input() call::
- <?php
echo $this->Form->input('password'); // No div, no label with class 'fancy'
echo $this->Form->input('username', array('label' => 'Username')); // has a label element same defaults
@@ -1583,7 +1510,6 @@ special ``_Token`` inputs are generated.
hashing. This also allows the fields to be manipulated by Javascript.
The ``$name`` parameter should be the entity name for the input::
- <?php
$this->Form->unlockField('User.id');
.. php:method:: secure(array $fields = array())
View
42 en/core-libraries/helpers/html.rst
@@ -98,14 +98,12 @@ methods of the HtmlHelper and how to use them.
:term:`plugin syntax`. To include ``app/Plugin/DebugKit/webroot/css/toolbar.css``
You could use the following::
- <?php
echo $this->Html->css('DebugKit.toolbar.css');
If you want to include a css file which shares a name with a loaded
plugin you can do the following. For example if you had a ``Blog`` plugin,
and also wanted to include ``app/webroot/css/Blog.common.css``, you would::
- <?php
echo $this->Html->css('Blog.common.css', null, array('plugin' => false));
.. versionchanged:: 2.1
@@ -137,7 +135,6 @@ methods of the HtmlHelper and how to use them.
::
- <?php
echo $this->Html->meta(
'favicon.ico',
'/favicon.ico',
@@ -166,7 +163,6 @@ methods of the HtmlHelper and how to use them.
This method can also be used to add the meta keywords and
descriptions. Example::
- <?php
echo $this->Html->meta(
'keywords',
'enter any meta keyword here'
@@ -185,7 +181,6 @@ methods of the HtmlHelper and how to use them.
should be set to an array. To output a robots noindex tag use the
following code::
- <?php
echo $this->Html->meta(array('name' => 'robots', 'content' => 'noindex'));
.. versionchanged:: 2.1
@@ -220,7 +215,6 @@ methods of the HtmlHelper and how to use them.
::
- <?php
echo $this->Html->docType();
// Outputs: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -242,7 +236,6 @@ methods of the HtmlHelper and how to use them.
array passed to the method. Especially handy if your CSS file is
dynamic.::
- <?php
echo $this->Html->style(array(
'background' => '#633',
'border-bottom' => '1px solid #000',
@@ -261,7 +254,6 @@ methods of the HtmlHelper and how to use them.
Creates a formatted image tag. The path supplied should be relative
to /app/webroot/img/.::
- <?php
echo $this->Html->image('cake_logo.png', array('alt' => 'CakePHP'));
Will output::
@@ -271,7 +263,6 @@ methods of the HtmlHelper and how to use them.
To create an image link specify the link destination using the
``url`` option in ``$htmlAttributes``.::
- <?php
echo $this->Html->image("recipes/6.jpg", array(
"alt" => "Brownies",
'url' => array('controller' => 'recipes', 'action' => 'view', 6)
@@ -286,7 +277,6 @@ methods of the HtmlHelper and how to use them.
If you are creating images in emails, or want absolute paths to images you
can use the ``fullBase`` option::
- <?php
echo $this->Html->image("logo.png", array('fullBase' => true));
Will output::
@@ -297,14 +287,12 @@ methods of the HtmlHelper and how to use them.
:term:`plugin syntax`. To include ``app/Plugin/DebugKit/webroot/img/icon.png``
You could use the following::
- <?php
echo $this->Html->image('DebugKit.icon.png');
If you want to include a image file which shares a name with a loaded
plugin you can do the following. For example if you had a ``Blog`` plugin,
and also wanted to include ``app/webroot/js/Blog.icon.png``, you would::
- <?php
echo $this->Html->image('Blog.icon.png', array('plugin' => false));
.. versionchanged:: 2.1
@@ -321,7 +309,6 @@ methods of the HtmlHelper and how to use them.
specify attributes for the element and whether or not the
``$title`` should be escaped.::
- <?php
echo $this->Html->link('Enter', '/pages/home', array('class' => 'button', 'target' => '_blank'));
Will output::
@@ -330,7 +317,6 @@ methods of the HtmlHelper and how to use them.
Use ``'full_base'=>true`` option for absolute URLs::
- <?php
echo $this->Html->link(
'Dashboard',
array('controller' => 'dashboards', 'action' => 'index', 'full_base' => true)
@@ -344,7 +330,6 @@ methods of the HtmlHelper and how to use them.
Specify ``$confirmMessage`` to display a javascript ``confirm()``
dialog::
- <?php
echo $this->Html->link(
'Delete',
array('controller' => 'recipes', 'action' => 'delete', 6),
@@ -358,7 +343,6 @@ methods of the HtmlHelper and how to use them.
Query strings can also be created with ``link()``.::
- <?php
echo $this->Html->link('View image', array(
'controller' => 'images',
'action' => 'view',
@@ -413,7 +397,6 @@ methods of the HtmlHelper and how to use them.
Returns a formatted audio/video tag::
- <?php
echo $this->Html->media('audio.mp4');
// Output
@@ -444,7 +427,6 @@ methods of the HtmlHelper and how to use them.
Returns text wrapped in a specified tag. If no text is specified
then only the opening <tag> is returned.::
- <?php
echo $this->Html->tag('span', 'Hello World.', array('class' => 'welcome'));
// Output
@@ -477,7 +459,6 @@ methods of the HtmlHelper and how to use them.
If no text is specified, only an opening div tag is returned.::
- <?php
echo $this->Html->div('error', 'Please enter your credit card number.');
// Output
@@ -492,7 +473,6 @@ methods of the HtmlHelper and how to use them.
Returns a text wrapped in a CSS-classed <p> tag. If no text is
supplied, only a starting <p> tag is returned.::
- <?php
echo $this->Html->para(null, 'Hello World.');
// Output
@@ -520,7 +500,6 @@ methods of the HtmlHelper and how to use them.
javascript file specified resides inside the ``/app/webroot/js``
directory.::
- <?php
echo $this->Html->script('scripts');
Will output::
@@ -530,12 +509,10 @@ methods of the HtmlHelper and how to use them.
You can link to files with absolute paths as well to link files
that are not in ``app/webroot/js``::
- <?php
echo $this->Html->script('/otherdir/script_file');
The first parameter can be an array to include multiple files.::
- <?php
echo $this->Html->script(array('jquery', 'wysiwyg', 'scripts'));
Will output::
@@ -547,26 +524,22 @@ methods of the HtmlHelper and how to use them.
You can append the script tag to a specific block using the ``block``
option::
- <?php
echo $this->Html->script('wysiwyg', array('block' => 'scriptBottom'));
In your layout you can output all the script tags added to 'scriptBottom'::
- <?php
echo $this->fetch('scriptBottom');
You can include script files from any loaded plugin using
:term:`plugin syntax`. To include ``app/Plugin/DebugKit/webroot/js/toolbar.js``
You could use the following::
- <?php
echo $this->Html->script('DebugKit.toolbar.js');
If you want to include a script file which shares a name with a loaded
plugin you can do the following. For example if you had a ``Blog`` plugin,
and also wanted to include ``app/webroot/js/Blog.plugins.js``, you would::
- <?php
echo $this->Html->script('Blog.plugins.js', array('plugin' => false));
.. versionchanged:: 2.1
@@ -602,7 +575,6 @@ methods of the HtmlHelper and how to use them.
An example of using ``scriptStart()`` and ``scriptEnd()`` would
be::
- <?php
$this->Html->scriptStart(array('inline' => false));
echo $this->Js->alert('I am in the javascript');
@@ -620,7 +592,6 @@ methods of the HtmlHelper and how to use them.
Build a nested list (UL/OL) out of an associative array::
- <?php
$list = array(
'Languages' => array(
'English' => array(
@@ -660,7 +631,6 @@ methods of the HtmlHelper and how to use them.
Creates a row of table header cells to be placed inside of <table>
tags.::
- <?php
echo $this->Html->tableHeaders(array('Date', 'Title', 'Active'));
// Output
@@ -689,7 +659,6 @@ methods of the HtmlHelper and how to use them.
As of 2.2 you can set attributes per column, these are used instead of the
defaults provided in the ``$thOptions``::
- <?php
echo $this->Html->tableHeaders(array(
'id',
array('Name' => array('class' => 'highlight')),
@@ -716,7 +685,6 @@ methods of the HtmlHelper and how to use them.
for odd- and even-numbered rows. Wrap a single table cell within an
array() for specific <td>-attributes. ::
- <?php
echo $this->Html->tableCells(array(
array('Jul 7th, 2007', 'Best Brownies', 'Yes'),
array('Jun 21st, 2007', 'Smart Cookies', 'Yes'),
@@ -764,7 +732,6 @@ methods of the HtmlHelper and how to use them.
generates the url for the controller and action combo. If full is
true, the full base URL will be prepended to the result::
- <?php
echo $this->Html->url(array(
"controller" => "posts",
"action" => "view",
@@ -778,7 +745,6 @@ methods of the HtmlHelper and how to use them.
URL with named parameters::
- <?php
echo $this->Html->url(array(
"controller" => "posts",
"action" => "view",
@@ -790,7 +756,6 @@ methods of the HtmlHelper and how to use them.
URL with extension::
- <?php
echo $this->Html->url(array(
"controller" => "posts",
"action" => "list",
@@ -802,7 +767,6 @@ methods of the HtmlHelper and how to use them.
URL (starting with '/') with the full base URL prepended::
- <?php
echo $this->Html->url('/posts', true);
// Output
@@ -810,7 +774,6 @@ methods of the HtmlHelper and how to use them.
URL with GET params and named anchor::
- <?php
echo $this->Html->url(array(
"controller" => "posts",
"action" => "search",
@@ -829,7 +792,6 @@ methods of the HtmlHelper and how to use them.
Returns a formatted existent block of ``$tag``::
- <?php
$this->Html->useTag(
'form',
'http://example.com',
@@ -850,7 +812,6 @@ Changing the tags output by HtmlHelper
like to use. To change the tags used create ``app/Config/html5_tags.php``
containing::
- <?php
$config = array('tags' => array(
'css' => '<link rel="%s" href="%s" %s>',
'style' => '<style%s>%s</style>',
@@ -873,13 +834,11 @@ Creating breadcrumb trails with HtmlHelper
breadcrumb trail in your app. To set this up, first add something
similar to the following in your layout template::
- <?php
echo $this->Html->getCrumbs(' > ', 'Home');
The ``$startText`` option can also accept an array. This gives more control
over the generated first link::
- <?php
echo $this->Html->getCrumbs(' > ', array(
'text' => $this->Html->image('home.png'),
'url' => array('controller' => 'pages', 'action' => 'display', 'home'),
@@ -897,7 +856,6 @@ Creating breadcrumb trails with HtmlHelper
Now, in your view you'll want to add the following to start the
breadcrumb trails on each of the pages::
- <?php
$this->Html->addCrumb('Users', '/users');
$this->Html->addCrumb('Add User', '/users/add');
View
35 en/core-libraries/helpers/js.rst
@@ -34,7 +34,6 @@ all pages, add this line to the <head> section of
``lib/Cake/View/Layouts/default.ctp`` if you have not created your
own)::
- <?php
echo $this->Html->script('jquery'); // Include jQuery library
Replace ``jquery`` with the name of your library file (.js will be
@@ -44,7 +43,6 @@ By default scripts are cached, and you must explicitly print out
the cache. To do this at the end of each page, include this line
just before the ending ``</body>`` tag::
- <?php
echo $this->Js->writeBuffer(); // Write cached scripts
.. warning::
@@ -55,7 +53,6 @@ just before the ending ``</body>`` tag::
Javascript engine selection is declared when you include the helper
in your controller::
- <?php
public $helpers = array('Js' => array('Jquery'));
The above would use the Jquery Engine in the instances of JsHelper
@@ -78,7 +75,6 @@ That said, there is one caveat:
To override the "$" shortcut, use the jQueryObject variable::
- <?php
$this->Js->JqueryEngine->jQueryObject = '$j';
echo $this->Html->scriptBlock(
'var $j = jQuery.noConflict();',
@@ -92,7 +88,6 @@ Using the JsHelper inside customHelpers
Declare the JsHelper in the ``$helpers`` array in your
customHelper::
- <?php
public $helpers = array('Js');
.. note::
@@ -103,7 +98,6 @@ customHelper::
If you are willing to use an other javascript engine than the
default, do the helper setup in your controller as follows::
- <?php
public $helpers = array(
'Js' => array('Prototype'),
'CustomHelper'
@@ -151,13 +145,11 @@ in the DOM, ``$this->Js->get()`` returns a $this, allowing you to
chain the methods using the selection. Method chaining allows you
to write shorter, more expressive code::
- <?php
$this->Js->get('#foo')->event('click', $eventCode);
Is an example of method chaining. Method chaining is not possible
in PHP4 and the above sample would be written like::
- <?php
$this->Js->get('#foo');
$this->Js->event('click', $eventCode);
@@ -239,14 +231,12 @@ buffering. By appending an boolean to the end of the arguments you
can force other methods to go into the buffer. For example the
``each()`` method does not normally buffer::
- <?php
$this->Js->each('alert("whoa!");', true);
The above would force the ``each()`` method to use the buffer.
Conversely if you want a method that does buffer to not buffer, you
can pass a ``false`` in as the last argument::
- <?php
$this->Js->event('click', 'alert("whoa!");', false);
This would force the event function which normally buffers to
@@ -276,7 +266,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example Use**::
- <?php
$json = $this->Js->object($data);
.. php:method:: sortable($options = array())
@@ -309,7 +298,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example Use**::
- <?php
$this->Js->get('#my-list');
$this->Js->sortable(array(
'distance' => 5,
@@ -356,7 +344,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example use**::
- <?php
$this->Js->event(
'click',
$this->Js->request(
@@ -371,7 +358,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
selection is used in subsequent operations until a new selection is
made::
- <?php
$this->Js->get('#element');
The ``JsHelper`` now will reference all other element based methods
@@ -405,7 +391,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example use**::
- <?php
$this->Js->get('#element');
$this->Js->drag(array(
'container' => '#content',
@@ -444,7 +429,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example use**::
- <?php
$this->Js->get('#element');
$this->Js->drop(array(
'accept' => '.items',
@@ -492,7 +476,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example use**::
- <?php
$this->Js->get('#element');
$this->Js->slider(array(
'complete' => 'onComplete',
@@ -536,7 +519,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
If you were using the jQuery engine::
- <?php
$this->Js->get('#element');
$result = $this->Js->effect('fadeIn');
@@ -560,7 +542,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example use**::
- <?php
$this->Js->get('#some-link');
$this->Js->event('click', $this->Js->alert('hey you!'));
@@ -577,7 +558,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
You can remove the ``return false;`` by passing setting the
``stop`` option to false::
- <?php
$this->Js->get('#some-link');
$this->Js->event('click', $this->Js->alert('hey you!'), array('stop' => false));
@@ -603,7 +583,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example**::
- <?php
$this->Js->get('div.message');
$this->Js->each('$(this).css({color: "red"});');
@@ -619,7 +598,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
default, ``alert`` does not buffer, and returns the script
snippet.::
- <?php
$alert = $this->Js->alert('Hey there');
.. php:method:: confirm($message)
@@ -628,7 +606,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
default, ``confirm`` does not buffer, and returns the script
snippet.::
- <?php
$alert = $this->Js->confirm('Are you sure?');
.. php:method:: prompt($message, $default)
@@ -637,7 +614,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
default, ``prompt`` does not buffer, and returns the script
snippet.::
- <?php
$prompt = $this->Js->prompt('What is your favorite color?', 'blue');
.. php:method:: submit($caption = null, $options = array())
@@ -665,13 +641,11 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example use**::
- <?php
echo $this->Js->submit('Save', array('update' => '#content'));
Will create a submit button with an attached onclick event. The
click event will be buffered by default.::
- <?php
echo $this->Js->submit('Save', array('update' => '#content', 'div' => false, 'type' => 'json', 'async' => false));
Shows how you can combine options that both
@@ -701,7 +675,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
**Example use**::
- <?php
echo $this->Js->link('Page 2', array('page' => 2), array('update' => '#content'));
Will create a link pointing to ``/page:2`` and updating #content
@@ -710,7 +683,6 @@ CakePHP core. Whenever you see separate lists for ``Options`` and
You can use the ``htmlAttributes`` option to add in additional
custom attributes.::
- <?php
echo $this->Js->link('Page 2', array('page' => 2), array(
'update' => '#content',
'htmlAttributes' => array('other' => 'value')
@@ -768,21 +740,18 @@ jQuery (or whichever library you are using). Also make sure to
include ``RequestHandlerComponent`` in your components. Add the
following to your controller::
- <?php
public $components = array('RequestHandler');
public $helpers = array('Js');
Next link in the javascript library you want to use. For this
example we'll be using jQuery::
- <?php
echo $this->Html->script('jquery');
Similar to 1.2 you need to tell the ``PaginatorHelper`` that you
want to make Javascript enhanced links instead of plain HTML ones.
To do so you use ``options()``::
- <?php
$this->Paginator->options(array(
'update' => '#content',
'evalScripts' => true
@@ -804,7 +773,6 @@ generated script content to reduce the number of ``<script>`` tags
in your source code you **must** call write the buffer out. At the
bottom of your view file. Be sure to include::
- <?php
echo $this->Js->writeBuffer();
If you omit this you will **not** be able to chain ajax pagination
@@ -841,7 +809,6 @@ will display a busy indicator animation that we will show and hide
with the ``JsHelper``. To do that we need to update our
``options()`` function::
- <?php
$this->Paginator->options(array(
'update' => '#content',
'evalScripts' => true,
@@ -858,4 +825,4 @@ control and more complex effects to be created.
.. meta::
:title lang=en: JsHelper
:description lang=en: The Js Helper supports the javascript libraries Prototype, jQuery and Mootools and provides methods for manipulating javascript.
- :keywords lang=en: js helper,javascript,cakephp jquery,cakephp mootools,cakephp prototype,cakephp jquery ui,cakephp scriptaculous,cakephp javascript,javascript engine
+ :keywords lang=en: js helper,javascript,cakephp jquery,cakephp mootools,cakephp prototype,cakephp jquery ui,cakephp scriptaculous,cakephp javascript,javascript engine
View
2  en/core-libraries/helpers/number.rst
@@ -23,4 +23,4 @@ formatting numbers.
.. meta::
:title lang=en: NumberHelper
:description lang=en: The Number Helper contains convenience methods that enable display numbers in common formats in your views.
- :keywords lang=en: number helper,currency,number format,number precision,format file size,format numbers
+ :keywords lang=en: number helper,currency,number format,number precision,format file size,format numbers
View
23 en/core-libraries/helpers/paginator.rst
@@ -34,21 +34,18 @@ Accepted keys for ``$options``:
Assuming you are paginating some posts, and are on page one::
- <?php
echo $this->Paginator->sort('user_id');
// creates
<a href="/posts/index/page:1/sort:user_id/direction:asc/">User Id</a>
You can use the title parameter to create custom text for your link::
- <?php
echo $this->Paginator->sort('user_id', 'User account');
// creates
<a href="/posts/index/page:1/sort:user_id/direction:asc/">User account</a>
If you are using HTML like images in your links remember to set escaping off::
- <?php
echo $this->Paginator->sort('user_id', '<em>User account</em>', array('escape' => false));
// creates
<a href="/posts/index/page:1/sort:user_id/direction:asc/"><em>User account</em></a>
@@ -56,7 +53,6 @@ If you are using HTML like images in your links remember to set escaping off::
The direction option can be used to set the default direction for a link. Once a
link is active, it will automatically switch directions like normal::
- <?php
echo $this->Paginator->sort('user_id', null, array('direction' => 'desc'));
// creates
<a href="/posts/index/page:1/sort:user_id/direction:desc/">User Id</a>
@@ -115,14 +111,12 @@ Supported options are:
While this method allows a lot of customization for its output. It is
also ok to just call the method without any params.::
- <?php
echo $this->Paginator->numbers();
Using the first and last options you can create links to the beginning
and end of the page set. The following would create a set of page links that
include links to the first 2 and last 2 pages in the paged results::
- <?php
echo $this->Paginator->numbers(array('first' => 2, 'last' => 2));
.. versionadded:: 2.1
@@ -157,7 +151,6 @@ pages in the paged data set.
A simple example would be::
- <?php
echo $this->Paginator->prev(' << ' . __('previous'), array(), null, array('class' => 'prev disabled'));
If you were currently on the second page of posts, you would get the following::
@@ -170,14 +163,12 @@ pages in the paged data set.
You can change the wrapping tag using the ``tag`` option::
- <?php
echo $this->Paginator->prev(__('previous'), array('tag' => 'li'));
// Would create
<li class="prev"><a rel="prev" href="/posts/index/page:1/sort:title/order:desc">previous</a></li>
You can also disable the wrapping tag::
- <?php
echo $this->Paginator->prev(__('previous'), array('tag' => false));
// Would create
<a class="prev" rel="prev" href="/posts/index/page:1/sort:title/order:desc">previous</a>
@@ -201,14 +192,12 @@ pages in the paged data set.
Returns a first or set of numbers for the first pages. If a string is given,
then only a link to the first page with the provided text will be created::
- <?php
echo $this->Paginator->first('< first');
The above creates a single link for the first page. Will output nothing if you
are on the first page. You can also use an integer to indicate how many first
paging links you want generated::
- <?php
echo $this->Paginator->first(3);
The above will create links for the first 3 pages, once you get to the third or
@@ -234,7 +223,6 @@ pages in the paged data set.
Gets the current page of the recordset for the given model::
- <?php
// Our url is: http://example.com/comments/view/page:3
echo $this->Paginator->current('Comment');
// Output is 3
@@ -280,7 +268,6 @@ There are a number of options for ``counter()``. The supported ones are:
You could also supply only a string to the counter method using the tokens
available. For example::
- <?php
echo $this->Paginator->counter(
'Page {:page} of {:pages}, showing {:current} records out of
{:count} total, starting on record {:start}, ending on {:end}'
@@ -288,7 +275,6 @@ There are a number of options for ``counter()``. The supported ones are:
Setting 'format' to range would output like '1 - 3 of 13'::
- <?php
echo $this->Paginator->counter(array(
'format' => 'range'
));
@@ -297,7 +283,6 @@ There are a number of options for ``counter()``. The supported ones are:
pages. Defaults to ' of '. This is used in conjunction with 'format' =
'pages' which is 'format' default value::
- <?php
echo $this->Paginator->counter(array(
'separator' => ' of a total of '
));
@@ -326,7 +311,6 @@ Sets all the options for the Paginator Helper. Supported options are:
You can also append additional url content into all urls generated in the
helper::
- <?php
$this->Paginator->options(array(
'url' => array(
'sort' => 'email', 'direction' => 'desc', 'page' => 6,
@@ -345,7 +329,6 @@ Sets all the options for the Paginator Helper. Supported options are:
* ``update`` The CSS selector of the element to update with the results of AJAX
pagination calls. If not specified, regular links will be created::
- <?php
$this->Paginator->options(array('update' => '#content'));
This is useful when doing :ref:`ajax-pagination`. Keep in mind that the value
@@ -365,7 +348,6 @@ this feature is in :php:class:`PaginatorComponent`, you have some additional
control in the view. You can use ``options()`` to indicate that you want other
named parameters to be converted::
- <?php
$this->Paginator->options(array('convertKeys' => array('your', 'keys', 'here')));
Configuring the PaginatorHelper to use a javascript helper
@@ -376,7 +358,6 @@ features. However, if you don't want that and want to use a custom helper
for ajax links, you can do so by changing the ``$helpers`` array in your controller.
After running ``paginate()`` do the following::
- <?php
// In your controller action.
$this->set('posts', $this->paginate());
$this->helpers['Paginator'] = array('ajax' => 'CustomJs');
@@ -450,7 +431,6 @@ of page navigation, also supplied by the PaginationHelper::
The wording output by the counter() method can also be customized
using special markers::
- <?php
echo $this->Paginator->counter(array(
'format' => 'Page {:page} of {:pages}, showing {:current} records out of
{:count} total, starting on record {:start}, ending on {:end}'
@@ -476,7 +456,6 @@ Other Methods
Creates a regular or AJAX link with pagination parameters::
- <?php
echo $this->Paginator->link('Sort by title on page 5',
array('sort' => 'title', 'page' => 5, 'direction' => 'desc'));
@@ -495,7 +474,6 @@ Other Methods
By default returns a full pagination URL string for use in non-standard
contexts (i.e. JavaScript).::
- <?php
echo $this->Paginator->url(array('sort' => 'title'), true);
.. php:method:: defaultModel()
@@ -507,7 +485,6 @@ Other Methods
Gets the current paging parameters from the resultset for the given model::
- <?php
debug($this->Paginator->params());
/*
Array
View
7 en/core-libraries/helpers/rss.rst
@@ -18,7 +18,6 @@ Before we jump too far ahead trying to get our webservice up and
running we need to do a few things. First parseExtensions needs to
be activated, this is done in ``app/Config/routes.php``::
- <?php
Router::parseExtensions('rss');
In the call above we’ve activated the .rss extension. When using
@@ -35,13 +34,11 @@ Controller Code
It is a good idea to add RequestHandler to your PostsController's
$components array. This will allow a lot of automagic to occur::
- <?php
public $components = array('RequestHandler');
Our view will also use the :php:class:`TextHelper` for formatting, so that
should be added to the controller as well::
- <?php
public $helpers = array('Text');
Before we can make an RSS version of our posts/index we need to get
@@ -54,7 +51,6 @@ make the RSS feed and the data for the html view you can use the
:php:meth:`RequestHandler::isRss()` method, otherwise your controller can stay
the same::
- <?php
// Modify the Posts Controller action that corresponds to
// the action which deliver the rss feed, which is the
// index action in our example
@@ -81,7 +77,6 @@ Layout
An Rss layout is very simple, put the following contents in
``app/View/Layouts/rss/default.ctp``::
- <?php
if (!isset($documentData)) {
$documentData = array();
}
@@ -116,7 +111,6 @@ done by using the :php:meth:`View::set()`` method which is analogous to the
Controller::set() method. Here though we are passing the channel's
metadata back to the layout::
- <?php
$this->set('channelData', array(
'title' => __("Most Recent Posts"),
'link' => $this->Html->url('/', true),
@@ -145,7 +139,6 @@ associative array into an element for each key value pair.
::
- <?php
// You should import Sanitize
App::uses('Sanitize', 'Utility');
View
4 en/core-libraries/helpers/session.rst
@@ -14,7 +14,6 @@ to the session.
As with the Session Component, data is read by using
:term:`dot notation` array structures::
- <?php
array('User' => array(
'username' => 'super@example.com'
));
@@ -63,7 +62,6 @@ Displaying notifications or flash messages
display them. Once a message is displayed, it will be removed and
not displayed again::
- <?php
echo $this->Session->flash();
The above will output a simple message, with the following html::
@@ -76,7 +74,6 @@ Displaying notifications or flash messages
and customize which element is used. In the controller you might
have code like::
- <?php
// in a controller
$this->Session->setFlash('The user could not be deleted.');
@@ -100,7 +97,6 @@ Displaying notifications or flash messages
You can also pass additional parameters into the ``flash()`` method, which
allow you to generate customized messages::
- <?php
// In the controller
$this->Session->setFlash('Thanks for your payment %s');
View
1  en/core-libraries/helpers/text.rst
@@ -25,7 +25,6 @@ truncating long stretches of text.
to any options defined in ``$htmlOptions`` (see
:php:meth:`HtmlHelper::link()`).::
- <?php
$myText = 'For more information regarding our world-famous pastries and desserts, contact info@example.com';
$linkedText = $this->Text->autoLinkEmails($myText);
View
3  en/core-libraries/helpers/time.rst
@@ -32,7 +32,6 @@ modifications to allow your users to set their time zone. Now that we know
the time zone of the logged in user we can correct the date and time on our
posts using the Time Helper::
- <?php
echo $this->Time->format('F jS, Y h:i A', $post['Post']['created'], null, $user['User']['time_zone']);
// Will display August 22nd, 2011 11:53 PM for a user in GMT+0
// August 22nd, 2011 03:53 PM for a user in GMT-8
@@ -48,4 +47,4 @@ accepts a valid timezone identifier string or an instance of `DateTimeZone` clas
.. meta::
:title lang=en: TimeHelper
:description lang=en: The Time Helper will help you format time and test time.
- :keywords lang=en: time helper,format time,timezone,unix epoch,time strings,time zone offset,utc,gmt
+ :keywords lang=en: time helper,format time,timezone,unix epoch,time strings,time zone offset,utc,gmt
View
2  en/deployment.rst
@@ -66,4 +66,4 @@ This assumes you are running a \*nix server, and have CakePHP in
.. meta::
:title lang=en: Deployment
- :keywords lang=en: stack traces,application extensions,set document,installation documentation,development features,generic error,document root,func,debug,caches,error messages,configuration files,webroot,deployment,cakephp,applications
+ :keywords lang=en: stack traces,application extensions,set document,installation documentation,development features,generic error,document root,func,debug,caches,error messages,configuration files,webroot,deployment,cakephp,applications
View
1  en/installation.rst
@@ -203,7 +203,6 @@ application </getting-started>`.
Not working? If you're getting timezone related error from PHP
uncomment one line in ``app/Config/core.php``::
- <?php
/**
* Uncomment this line and correct your server timezone to fix
* any date & time related errors.
View
3  en/models.rst
@@ -32,7 +32,6 @@ Comment are all examples of models, each associated with another.
Here is a simple example of a model definition in CakePHP::
- <?php
class Ingredient extends AppModel {
public $name = 'Ingredient';
}
@@ -88,7 +87,6 @@ the controller. For example, a controller named
IngredientsController will automatically initialize the Ingredient
model and attach it to the controller at ``$this->Ingredient``::
- <?php
class IngredientsController extends AppController {
public function index() {
//grab all ingredients and pass it to the view:
@@ -101,7 +99,6 @@ Associated models are available through the main model. In the
following example, Recipe has an association with the Ingredient
model::
- <?php
class Recipe extends AppModel {
public function steakRecipes() {
View
8 en/models/data-validation/validating-data-from-the-controller.rst
@@ -12,7 +12,6 @@ First, set the data to the model:
::
- <?php
$this->ModelName->set($this->request->data);
Then, to check if the data validates, use the validates method of
@@ -21,7 +20,6 @@ doesn't:
::
- <?php
if ($this->ModelName->validates()) {
// it validated logic
} else {
@@ -39,7 +37,6 @@ can pass an options array specifying the fields to validate. e.g.
::
- <?php
if ($this->User->validates(array('fieldList' => array('email', 'password')))) {
// valid
} else {
@@ -52,7 +49,6 @@ invalidFields method also returns that data as the result.
::
- <?php
$errors = $this->ModelName->invalidFields(); // contains validationErrors array
The validation errors list is not cleared between successive calls to ``invalidFields()``
@@ -72,7 +68,6 @@ used:
::
- <?php
if ($this->ModelName->saveAll($this->request->data, array('validate' => 'only'))) {
// validates
} else {
@@ -84,7 +79,6 @@ to avoid second check.
::
- <?php
if ($this->ModelName->saveAll($this->request->data, array('validate' => false))) {
// saving without validation
}
@@ -92,4 +86,4 @@ to avoid second check.
.. meta::
:title lang=en: Validating Data from the Controller
- :keywords lang=en: password rules,validations,subset,array,logs,logic,email,first name last name,models,options,data model
+ :keywords lang=en: password rules,validations,subset,array,logs,logic,email,first name last name,models,options,data model
View
17 en/plugins.rst
@@ -27,7 +27,6 @@ app/Config/bootstrap.php.
You can either load them one by one or all of them in a single call::
- <?php
CakePlugin::loadAll(); // Loads all plugins at once
CakePlugin::load('ContactManager'); //Loads a single plugin
@@ -46,7 +45,6 @@ certain plugins.
No problem::
- <?php
CakePlugin::loadAll(array(
'Blog' => array('routes' => true),
'ContactManager' => array('bootstrap' => true),
@@ -64,7 +62,6 @@ every plugin that doesn't have a more specific configuration.
Load the bootstrap file from all plugins, and the routes from the Blog plugin::
- <?php
CakePlugin::loadAll(array(
array('bootstrap' => true),
'Blog' => array('routes' => true)
@@ -91,7 +88,6 @@ Advanced bootstrapping
If you like to load more than one bootstrap file for a plugin. You can specify
an array of files for the bootstrap configuration key::
- <?php
CakePlugin::loadAll(array(
'Blog' => array(
'bootstrap' => array(
@@ -104,7 +100,6 @@ an array of files for the bootstrap configuration key::
You can also specify a callable function that needs to be called when the plugin
has been loaded::
- <?php
function aCallableFunction($pluginName, $config) {
@@ -128,13 +123,11 @@ ContactInfoHelper to output some pretty contact information in
one of your views. In your controller, your $helpers array
could look like this::
- <?php
public $helpers = array('ContactManager.ContactInfo');
You would then be able to access the ContactInfoHelper just like
any other helper in your view, such as::
- <?php
echo $this->ContactInfo->address($contact);
@@ -178,14 +171,12 @@ application can, such as Config, Console, Lib, webroot, etc.
::
- <?php
// /app/Plugin/ContactManager/Controller/ContactManagerAppController.php:
class ContactManagerAppController extends AppController {
}
::
- <?php
// /app/Plugin/ContactManager/Model/ContactManagerAppModel.php:
class ContactManagerAppModel extends AppModel {
}
@@ -221,7 +212,6 @@ this plugin.
So, we place our new ContactsController in
/app/Plugin/ContactManager/Controller and it looks like so::
- <?php
// app/Plugin/ContactManager/Controller/ContactsController.php
class ContactsController extends ContactManagerAppController {
public $uses = array('ContactManager.Contact');
@@ -259,7 +249,6 @@ Models for the plugin are stored in /app/Plugin/ContactManager/Model.
We've already defined a ContactsController for this plugin, so let's
create the model for that controller, called Contact::
- <?php
// /app/Plugin/ContactManager/Model/Contact.php:
class Contact extends ContactManagerAppModel {
}
@@ -275,7 +264,6 @@ Let’s create that next.
For example::
- <?php
// /app/Plugin/ContactManager/Model/Contact.php:
class Contact extends ContactManagerAppModel {
public $hasMany = array('ContactManager.AltName');
@@ -284,7 +272,6 @@ For example::
If you would prefer that the array keys for the association not
have the plugin prefix on them, use the alternative syntax::
- <?php
// /app/Plugin/ContactManager/Model/Contact.php:
class Contact extends ContactManagerAppModel {
public $hasMany = array(
@@ -382,7 +369,6 @@ Referring to your component from inside or outside of your plugin
requires only that you prefix the plugin name before the name of the
component. For example::
- <?php
// Component defined in 'ContactManager' plugin
class ExampleComponent extends Component {
}
@@ -397,7 +383,6 @@ The same technique applies to Helpers and Behaviors.
When creating Helpers you may find AppHelper is not automatically
available. You should declare the resources you need with Uses::
- <?php
// Declare use of AppHelper for your Plugin's Helper
App::uses('AppHelper', 'View/Helper');
@@ -448,4 +433,4 @@ applications:
.. meta::
:title lang=en: Plugins
- :keywords lang=en: plugin folder,configuration database,bootstrap,management module,little space,database connection,webroot,user management,contactmanager,array,config,cakephp,models,php,directories,blog,plugins,applications
+ :keywords lang=en: plugin folder,configuration database,bootstrap,management module,little space,database connection,webroot,user management,contactmanager,array,config,cakephp,models,php,directories,blog,plugins,applications
View
2  en/tutorials-and-examples.rst
@@ -22,4 +22,4 @@ and components.
.. meta::
:title lang=en: Tutorials & Examples
- :keywords lang=en: application tutorials,glob,bakery,repository,applications,blog,acl
+ :keywords lang=en: application tutorials,glob,bakery,repository,applications,blog,acl
View
11 en/tutorials-and-examples/blog-auth-example/auth.rst
@@ -29,7 +29,6 @@ us when implementing the user login.
Next step is to create our User model, responsible for finding, saving and
validating any user data::
- <?php
// app/Model/User.php
class User extends AppModel {
public $validate = array(
@@ -59,7 +58,6 @@ Let's also create our UsersController, the following contents correspond to a
basic `baked` UsersController class using the code generation utilities bundled
with CakePHP::
- <?php
// app/Controller/UsersController.php
class UsersController extends AppController {
@@ -137,7 +135,6 @@ will show just the add.ctp::
<?php echo $this->Form->create('User'); ?>
<fieldset>
<legend><?php echo __('Add User'); ?></legend>
- <?php
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->input('role', array(
@@ -159,7 +156,6 @@ users to the actions they are allowed to reach.
To add this component to your application open your ``app/Controller/AppController.php``
file and add the following lines::
- <?php
// app/Controller/AppController.php
class AppController extends Controller {
//...
@@ -192,7 +188,6 @@ and, more importantly, hash their password so it is not stored as plain text in
our database. Let's tell the AuthComponent to let un-authenticated users access
the users add function and implement the login and logout action::
- <?php
// app/Controller/UsersController.php
public function beforeFilter() {
@@ -217,7 +212,6 @@ the users add function and implement the login and logout action::
Password hashing is not done yet, open your ``app/Model/User.php`` model file
and add the following::
- <?php
// app/Model/User.php
App::uses('AuthComponent', 'Controller/Component');
class User extends AppModel {
@@ -242,7 +236,6 @@ the login function, here it is::
<?php echo $this->Form->create('User'); ?>
<fieldset>
<legend><?php echo __('Please enter your username and password'); ?></legend>
- <?php
echo $this->Form->input('username');
echo $this->Form->input('password');
?>
@@ -284,7 +277,6 @@ reference to the User model::
Also, a small change in the PostsController is required to store the currently
logged in user as a reference for the created post::
- <?php
// app/Controller/PostsController.php
public function add() {
if ($this->request->is('post')) {
@@ -306,7 +298,6 @@ url, while normal users (the author role) can only access the permitted actions.
Open again the AppController class and add a few more options to the Auth
config::
- <?php
// app/Controller/AppController.php
public $components = array(
@@ -340,7 +331,6 @@ add to PostsController should allow authors to create posts but prevent the
edition of posts if the author does not match. Open the file ``PostsController.php``
and add the following content::
- <?php
// app/Controller/PostsController.php
public function isAuthorized($user) {
@@ -368,7 +358,6 @@ the user is authorized to edit the post or not, we're calling a ``isOwnedBy()``
function in the Post model. It is in general a good practice to move as much
logic as possible into models. Let's then implement the function::
- <?php
// app/Model/Post.php
public function isOwnedBy($post, $user) {
View
3  en/tutorials-and-examples/blog/blog.rst
@@ -116,7 +116,6 @@ values in the ``$default`` array with those that apply to your
setup. A sample completed configuration array might look something
like the following::
- <?php
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
@@ -155,7 +154,6 @@ salt value by editing ``/app/Config/core.php`` line 187. It doesn't
much matter what the new value is, as long as it's not easily
guessed::
- <?php
/**
* A random string used in security hashing methods.
*/
@@ -166,7 +164,6 @@ default seed value by editing ``/app/Config/core.php`` line 192. It
doesn't much matter what the new value is, as long as it's not
easily guessed::
- <?php
/**
* A random numeric string (digits only) used to encrypt/decrypt strings.
*/