mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Update citations from application to app
This commit is contained in:
parent
95193c5f61
commit
0eb8b653b4
@ -49,7 +49,7 @@ in it::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Then save the file to your **application/Controllers/** directory.
|
Then save the file to your **app/Controllers/** directory.
|
||||||
|
|
||||||
Now normally you would visit the your site using a URL similar to this::
|
Now normally you would visit the your site using a URL similar to this::
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ building out custom code generators for your company.
|
|||||||
Running Commands
|
Running Commands
|
||||||
****************
|
****************
|
||||||
|
|
||||||
Commands are run from the command line, in the root directory. The same one that holds the **/application**
|
Commands are run from the command line, in the root directory. The same one that holds the **/app**
|
||||||
and **/system** directories. A custom script, **spark** has been provided that is used to run any of the
|
and **/system** directories. A custom script, **spark** has been provided that is used to run any of the
|
||||||
cli commands::
|
cli commands::
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ File Location
|
|||||||
=============
|
=============
|
||||||
|
|
||||||
Commands must be stored within a directory named **Commands**. However, that directory can be located anywhere
|
Commands must be stored within a directory named **Commands**. However, that directory can be located anywhere
|
||||||
that the :doc:`Autoloader </concepts/autoloader>` can locate it. This could be in **/application/Commands**, or
|
that the :doc:`Autoloader </concepts/autoloader>` can locate it. This could be in **/app/Commands**, or
|
||||||
a directory that you keep commands in to use in all of your project development, like **Acme/Commands**.
|
a directory that you keep commands in to use in all of your project development, like **Acme/Commands**.
|
||||||
|
|
||||||
.. note:: When the commands are executed, the full CodeIgniter cli environment has been loaded, making it
|
.. note:: When the commands are executed, the full CodeIgniter cli environment has been loaded, making it
|
||||||
@ -77,7 +77,7 @@ An Example Command
|
|||||||
==================
|
==================
|
||||||
|
|
||||||
Let's step through an example command whose only function is to report basic information about the application
|
Let's step through an example command whose only function is to report basic information about the application
|
||||||
itself, for demonstration purposes. Start by creating a new file at **/application/Commands/AppInfo.php**. It
|
itself, for demonstration purposes. Start by creating a new file at **/app/Commands/AppInfo.php**. It
|
||||||
should contain the following code::
|
should contain the following code::
|
||||||
|
|
||||||
<?php namespace App\Commands;
|
<?php namespace App\Commands;
|
||||||
|
@ -18,7 +18,7 @@ the data storage.
|
|||||||
|
|
||||||
At their most basic, controllers and models are simply classes that have a specific job. They are not the only class
|
At their most basic, controllers and models are simply classes that have a specific job. They are not the only class
|
||||||
types that you can use, obviously, but the make up the core of how this framework is designed to be used. They even
|
types that you can use, obviously, but the make up the core of how this framework is designed to be used. They even
|
||||||
have designated directories in the **/application** directory for their storage, though you're free to store them
|
have designated directories in the **/app** directory for their storage, though you're free to store them
|
||||||
wherever you desire, as long as they are properly namespaced. We will discuss that in more detail below.
|
wherever you desire, as long as they are properly namespaced. We will discuss that in more detail below.
|
||||||
|
|
||||||
Let's take a closer look at each of these three main components.
|
Let's take a closer look at each of these three main components.
|
||||||
@ -37,11 +37,11 @@ Views get the data to display from the controllers, who pass it to the views as
|
|||||||
with simple ``echo`` calls. You can also display other views within a view, making it pretty simple to display a
|
with simple ``echo`` calls. You can also display other views within a view, making it pretty simple to display a
|
||||||
common header or footer on every page.
|
common header or footer on every page.
|
||||||
|
|
||||||
Views are generally stored in **/application/Views**, but can quickly become unwieldy if not organized in some fashion.
|
Views are generally stored in **/app/Views**, but can quickly become unwieldy if not organized in some fashion.
|
||||||
CodeIgniter does not enforce any type of organization, but a good rule of thumb would be to create a new directory in
|
CodeIgniter does not enforce any type of organization, but a good rule of thumb would be to create a new directory in
|
||||||
the **Views** directory for each controller. Then, name views by the method name. This makes them very easy find later
|
the **Views** directory for each controller. Then, name views by the method name. This makes them very easy find later
|
||||||
on. For example, a user's profile might be displayed in a controller named ``User``, and a method named ``profile``.
|
on. For example, a user's profile might be displayed in a controller named ``User``, and a method named ``profile``.
|
||||||
You might store the view file for this method in **/application/Views/User/Profile.php**.
|
You might store the view file for this method in **/app/Views/User/Profile.php**.
|
||||||
|
|
||||||
That type of organization works great as a base habit to get into. At times you might need to organize it differently.
|
That type of organization works great as a base habit to get into. At times you might need to organize it differently.
|
||||||
That's not a problem. As long as CodeIgniter can find the file, it can display it.
|
That's not a problem. As long as CodeIgniter can find the file, it can display it.
|
||||||
@ -61,7 +61,7 @@ it's saved to meet company standards, or formatting a column in a certain way be
|
|||||||
By keeping these business requirements in the model, you won't repeat code throughout several controllers and accidentally
|
By keeping these business requirements in the model, you won't repeat code throughout several controllers and accidentally
|
||||||
miss updating an area.
|
miss updating an area.
|
||||||
|
|
||||||
Models are typically stored in **/application/Models**, though they can use a namespace to be grouped however you need.
|
Models are typically stored in **/app/Models**, though they can use a namespace to be grouped however you need.
|
||||||
|
|
||||||
:doc:`Find out more about models </models/model>`
|
:doc:`Find out more about models </models/model>`
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ The other responsibility of the controller is to handle everything that pertains
|
|||||||
authentication, web safety, encoding, etc. In short, the controller is where you make sure that people are allowed to
|
authentication, web safety, encoding, etc. In short, the controller is where you make sure that people are allowed to
|
||||||
be there, and they get the data they need in a format they can use.
|
be there, and they get the data they need in a format they can use.
|
||||||
|
|
||||||
Controllers are typically stored in **/application/Controllers**, though they can use a namespace to be grouped however
|
Controllers are typically stored in **/app/Controllers**, though they can use a namespace to be grouped however
|
||||||
you need.
|
you need.
|
||||||
|
|
||||||
:doc:`Find out more about controllers </incoming/controllers>`
|
:doc:`Find out more about controllers </incoming/controllers>`
|
||||||
|
@ -79,7 +79,7 @@ create a new class that implements the ``RouterCollectionInterface``::
|
|||||||
// Implement required methods here.
|
// Implement required methods here.
|
||||||
}
|
}
|
||||||
|
|
||||||
Finally, modify **/application/Config/Services.php** to create a new instance of ``MyRouter``
|
Finally, modify **/app/Config/Services.php** to create a new instance of ``MyRouter``
|
||||||
instead of ``CodeIgniter\Router\RouterCollection``::
|
instead of ``CodeIgniter\Router\RouterCollection``::
|
||||||
|
|
||||||
public static function routes()
|
public static function routes()
|
||||||
|
@ -8,18 +8,18 @@ can change to meet the needs of your application.
|
|||||||
Default Directories
|
Default Directories
|
||||||
===================
|
===================
|
||||||
|
|
||||||
A fresh install has six directories: ``/application``, ``/system``, ``/public``,
|
A fresh install has six directories: ``/app``, ``/system``, ``/public``,
|
||||||
``/writable``, ``/tests`` and ``/docs``.
|
``/writable``, ``/tests`` and ``/docs``.
|
||||||
Each of these directories has a very specific part to play.
|
Each of these directories has a very specific part to play.
|
||||||
|
|
||||||
application
|
app
|
||||||
-----------
|
---
|
||||||
The ``application`` directory is where all of your application code lives. This comes with a default directory
|
The ``app`` directory is where all of your application code lives. This comes with a default directory
|
||||||
structure that works well for many applications. The following folders make up the basic contents:
|
structure that works well for many applications. The following folders make up the basic contents:
|
||||||
|
|
||||||
.. code-block:: none
|
.. code-block:: none
|
||||||
|
|
||||||
/application
|
/app
|
||||||
/Config Stores the configuration files
|
/Config Stores the configuration files
|
||||||
/Controllers Controllers determine the program flow
|
/Controllers Controllers determine the program flow
|
||||||
/Database Stores the database migrations and seeds files
|
/Database Stores the database migrations and seeds files
|
||||||
@ -31,7 +31,7 @@ structure that works well for many applications. The following folders make up t
|
|||||||
/ThirdParty ThirdParty libraries that can be used in application
|
/ThirdParty ThirdParty libraries that can be used in application
|
||||||
/Views Views make up the HTML that is displayed to the client.
|
/Views Views make up the HTML that is displayed to the client.
|
||||||
|
|
||||||
Because the ``application`` directory is already namespaced, you should feel free to modify the structure
|
Because the ``app`` directory is already namespaced, you should feel free to modify the structure
|
||||||
of this directory to suit your application's needs. For example, you might decide to start using the Repository
|
of this directory to suit your application's needs. For example, you might decide to start using the Repository
|
||||||
pattern and Entity Models to work with your data. In this case, you could rename the ``Models`` directory to
|
pattern and Entity Models to work with your data. In this case, you could rename the ``Models`` directory to
|
||||||
``Repositories``, and add a new ``Entities`` directory.
|
``Repositories``, and add a new ``Entities`` directory.
|
||||||
@ -40,7 +40,7 @@ pattern and Entity Models to work with your data. In this case, you could rename
|
|||||||
routing to controllers, and will need to define all of your routes in the routes file.
|
routing to controllers, and will need to define all of your routes in the routes file.
|
||||||
|
|
||||||
All files in this directory live under the ``App`` namespace, though you are free to change that in
|
All files in this directory live under the ``App`` namespace, though you are free to change that in
|
||||||
**application/Config/Constants.php**.
|
**app/Config/Constants.php**.
|
||||||
|
|
||||||
system
|
system
|
||||||
------
|
------
|
||||||
@ -84,4 +84,4 @@ Modifying Directory Locations
|
|||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
If you've relocated any of the main directories, you can change the configuration
|
If you've relocated any of the main directories, you can change the configuration
|
||||||
settings inside ``application/Config/Paths``.
|
settings inside ``app/Config/Paths``.
|
||||||
|
@ -8,7 +8,7 @@ Database Configuration
|
|||||||
|
|
||||||
CodeIgniter has a config file that lets you store your database
|
CodeIgniter has a config file that lets you store your database
|
||||||
connection values (username, password, database name, etc.). The config
|
connection values (username, password, database name, etc.). The config
|
||||||
file is located at application/Config/Database.php. You can also set
|
file is located at app/Config/Database.php. You can also set
|
||||||
database connection values in the .env file. See below for more details.
|
database connection values in the .env file. See below for more details.
|
||||||
|
|
||||||
The config settings are stored in a class property that is an array with this
|
The config settings are stored in a class property that is an array with this
|
||||||
|
@ -11,7 +11,7 @@ need to be run against the production machines next time you deploy.
|
|||||||
The database table **migration** tracks which migrations have already been
|
The database table **migration** tracks which migrations have already been
|
||||||
run so all you have to do is update your application files and
|
run so all you have to do is update your application files and
|
||||||
call ``$migration->current()`` to work out which migrations should be run.
|
call ``$migration->current()`` to work out which migrations should be run.
|
||||||
The current version is found in **application/Config/Migrations.php**.
|
The current version is found in **app/Config/Migrations.php**.
|
||||||
|
|
||||||
.. contents::
|
.. contents::
|
||||||
:local:
|
:local:
|
||||||
@ -36,7 +36,7 @@ method taken. Two numbering styles are available:
|
|||||||
the preferred scheme in CodeIgniter 3.0 and later.
|
the preferred scheme in CodeIgniter 3.0 and later.
|
||||||
|
|
||||||
The desired style may be selected using the ``$type`` setting in your
|
The desired style may be selected using the ``$type`` setting in your
|
||||||
*application/Config/Migrations.php* file. The default setting is timestamp.
|
*app/Config/Migrations.php* file. The default setting is timestamp.
|
||||||
|
|
||||||
Regardless of which numbering style you choose to use, prefix your migration
|
Regardless of which numbering style you choose to use, prefix your migration
|
||||||
files with the migration number followed by an underscore and a descriptive
|
files with the migration number followed by an underscore and a descriptive
|
||||||
@ -50,7 +50,7 @@ Create a Migration
|
|||||||
******************
|
******************
|
||||||
|
|
||||||
This will be the first migration for a new site which has a blog. All
|
This will be the first migration for a new site which has a blog. All
|
||||||
migrations go in the **application/Database/Migrations/** directory and have names such
|
migrations go in the **app/Database/Migrations/** directory and have names such
|
||||||
as *20121031100537_Add_blog.php*.
|
as *20121031100537_Add_blog.php*.
|
||||||
::
|
::
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ as *20121031100537_Add_blog.php*.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Then in **application/Config/Migrations.php** set ``$currentVersion = 20121031100537;``.
|
Then in **app/Config/Migrations.php** set ``$currentVersion = 20121031100537;``.
|
||||||
|
|
||||||
The database connection and the database Forge class are both available to you through
|
The database connection and the database Forge class are both available to you through
|
||||||
``$this->db`` and ``$this->forge``, respectively.
|
``$this->db`` and ``$this->forge``, respectively.
|
||||||
@ -108,7 +108,7 @@ Database Groups
|
|||||||
===============
|
===============
|
||||||
|
|
||||||
A migration will only be run against a single database group. If you have multiple groups defined in
|
A migration will only be run against a single database group. If you have multiple groups defined in
|
||||||
**application/Config/Database.php**, then it will run against the ``$defaultGroup`` as specified
|
**app/Config/Database.php**, then it will run against the ``$defaultGroup`` as specified
|
||||||
in that same configuration file. There may be times when you need different schemas for different
|
in that same configuration file. There may be times when you need different schemas for different
|
||||||
database groups. Perhaps you have one database that is used for all general site information, while
|
database groups. Perhaps you have one database that is used for all general site information, while
|
||||||
another database is used for mission critical data. You can ensure that migrations are run only
|
another database is used for mission critical data. You can ensure that migrations are run only
|
||||||
@ -128,7 +128,7 @@ Namespaces
|
|||||||
==========
|
==========
|
||||||
|
|
||||||
The migration library can automatically scan all namespaces you have defined within
|
The migration library can automatically scan all namespaces you have defined within
|
||||||
**application/Config/Autoload.php** and its ``$psr4`` property for matching directory
|
**app/Config/Autoload.php** and its ``$psr4`` property for matching directory
|
||||||
names. It will include all migrations it finds in Database/Migrations.
|
names. It will include all migrations it finds in Database/Migrations.
|
||||||
|
|
||||||
Each namespace has it's own version sequence, this will help you upgrade and downgrade each module (namespace) without affecting other namespaces.
|
Each namespace has it's own version sequence, this will help you upgrade and downgrade each module (namespace) without affecting other namespaces.
|
||||||
@ -149,7 +149,7 @@ re-usable, modular code suites.
|
|||||||
Usage Example
|
Usage Example
|
||||||
*************
|
*************
|
||||||
|
|
||||||
In this example some simple code is placed in **application/Controllers/Migrate.php**
|
In this example some simple code is placed in **app/Controllers/Migrate.php**
|
||||||
to update the schema::
|
to update the schema::
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -265,7 +265,7 @@ You can use (refresh) with the following options:
|
|||||||
|
|
||||||
**create**
|
**create**
|
||||||
|
|
||||||
Creates a skeleton migration file in **application/Database/Migrations**.
|
Creates a skeleton migration file in **app/Database/Migrations**.
|
||||||
|
|
||||||
- When migration type is timestamp, using the YYYYMMDDHHIISS format::
|
- When migration type is timestamp, using the YYYYMMDDHHIISS format::
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ You can use (create) with the following options:
|
|||||||
Migration Preferences
|
Migration Preferences
|
||||||
*********************
|
*********************
|
||||||
|
|
||||||
The following is a table of all the config options for migrations, available in **application/Config/Migrations.php**.
|
The following is a table of all the config options for migrations, available in **app/Config/Migrations.php**.
|
||||||
|
|
||||||
========================== ====================== ========================== =============================================================
|
========================== ====================== ========================== =============================================================
|
||||||
Preference Default Options Description
|
Preference Default Options Description
|
||||||
@ -308,7 +308,7 @@ Class Reference
|
|||||||
:rtype: mixed
|
:rtype: mixed
|
||||||
|
|
||||||
Migrates up to the current version (whatever is set for
|
Migrates up to the current version (whatever is set for
|
||||||
``$currentVersion`` in *application/Config/Migrations.php*).
|
``$currentVersion`` in *app/Config/Migrations.php*).
|
||||||
|
|
||||||
.. php:method:: findMigrations()
|
.. php:method:: findMigrations()
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@ event or setting information, and more.
|
|||||||
Database seeds are simple classes that must have a **run()** method, and extend **CodeIgniter\Database\Seeder**.
|
Database seeds are simple classes that must have a **run()** method, and extend **CodeIgniter\Database\Seeder**.
|
||||||
Within the **run()** the class can create any form of data that it needs to. It has access to the database
|
Within the **run()** the class can create any form of data that it needs to. It has access to the database
|
||||||
connection and the forge through ``$this->db`` and ``$this->forge``, respectively. Seed files must be
|
connection and the forge through ``$this->db`` and ``$this->forge``, respectively. Seed files must be
|
||||||
stored within the **application/Database/Seeds** directory. The name of the file must match the name of the class.
|
stored within the **app/Database/Seeds** directory. The name of the file must match the name of the class.
|
||||||
::
|
::
|
||||||
|
|
||||||
// application/Database/Seeds/SimpleSeeder.php
|
// app/Database/Seeds/SimpleSeeder.php
|
||||||
class SimpleSeeder extends \CodeIgniter\Database\Seeder
|
class SimpleSeeder extends \CodeIgniter\Database\Seeder
|
||||||
{
|
{
|
||||||
public function run()
|
public function run()
|
||||||
|
@ -322,7 +322,7 @@ Core Constants
|
|||||||
|
|
||||||
.. php:const:: APPPATH
|
.. php:const:: APPPATH
|
||||||
|
|
||||||
The path to the **application** directory.
|
The path to the **app** directory.
|
||||||
|
|
||||||
.. php:const:: ROOTPATH
|
.. php:const:: ROOTPATH
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ PageNotFoundException
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
This is used to signal a 404, Page Not Found error. When thrown, the system will show the view found at
|
This is used to signal a 404, Page Not Found error. When thrown, the system will show the view found at
|
||||||
``/application/views/errors/html/error_404.php``. You should customize all of the error views for your site.
|
``/app/views/errors/html/error_404.php``. You should customize all of the error views for your site.
|
||||||
If, in ``Config/Routes.php``, you have specified a 404 Override, that will be called instead of the standard
|
If, in ``Config/Routes.php``, you have specified a 404 Override, that will be called instead of the standard
|
||||||
404 page::
|
404 page::
|
||||||
|
|
||||||
|
@ -2,32 +2,32 @@
|
|||||||
Downloading CodeIgniter
|
Downloading CodeIgniter
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
The CodeIgniter 4 open source project has its own
|
The CodeIgniter 4 open source project has its own
|
||||||
`Github organization <https://github.com/codeigniter4>`_.
|
`Github organization <https://github.com/codeigniter4>`_.
|
||||||
|
|
||||||
There are a number of repositories there of interest:
|
There are a number of repositories there of interest:
|
||||||
|
|
||||||
- `CodeIgniter4 <https://github.com/codeigniter4/CodeIgniter4>`_
|
- `CodeIgniter4 <https://github.com/codeigniter4/CodeIgniter4>`_
|
||||||
holds the codebase for the project, including unit testing
|
holds the codebase for the project, including unit testing
|
||||||
and the source from which the user guide is built.
|
and the source from which the user guide is built.
|
||||||
This would be used by contributors to the project.
|
This would be used by contributors to the project.
|
||||||
- `framework <https://github.com/codeigniter4/framework>`_
|
- `framework <https://github.com/codeigniter4/framework>`_
|
||||||
holds the released versions of the framework.
|
holds the released versions of the framework.
|
||||||
This would be normally be used by developers.
|
This would be normally be used by developers.
|
||||||
- `appstarter <https://github.com/codeigniter4/appstarter>`_
|
- `appstarter <https://github.com/codeigniter4/appstarter>`_
|
||||||
holds the released application starter, with application
|
holds the released application starter, with app
|
||||||
and public folders, but with only a composer
|
and public folders, but with only a composer
|
||||||
dependency on the framework.
|
dependency on the framework.
|
||||||
This is meant as the easy way to start a CodeIgniter 4 project.
|
This is meant as the easy way to start a CodeIgniter 4 project.
|
||||||
- `userguide <https://github.com/codeigniter4/userguide>`_
|
- `userguide <https://github.com/codeigniter4/userguide>`_
|
||||||
holds the pre-built user guide. It can be downloaded
|
holds the pre-built user guide. It can be downloaded
|
||||||
on its own, or `viewed online <https://codeigniter4.github.io/userguide>`_.
|
on its own, or `viewed online <https://codeigniter4.github.io/userguide>`_.
|
||||||
- `translations <https://github.com/codeigniter4/translations>`_
|
- `translations <https://github.com/codeigniter4/translations>`_
|
||||||
holds translations of the CodeIgniter 4 system messages.
|
holds translations of the CodeIgniter 4 system messages.
|
||||||
Developers can use this for :doc:`localization </outgoing/localization>`.
|
Developers can use this for :doc:`localization </outgoing/localization>`.
|
||||||
- `coding-standard <https://github.com/codeigniter4/coding-standard>`_
|
- `coding-standard <https://github.com/codeigniter4/coding-standard>`_
|
||||||
holds the coding conventions we use for source code that is
|
holds the coding conventions we use for source code that is
|
||||||
part of the framework itself.
|
part of the framework itself.
|
||||||
It is a dependency of the codebase repository, for contributors.
|
It is a dependency of the codebase repository, for contributors.
|
||||||
|
|
||||||
In all the above, the latest version of a repository can be downloaded
|
In all the above, the latest version of a repository can be downloaded
|
||||||
|
@ -155,12 +155,12 @@ Turning CSP On
|
|||||||
--------------
|
--------------
|
||||||
|
|
||||||
By default, support for this is off. To enable support in your application, edit the ``CSPEnabled`` value in
|
By default, support for this is off. To enable support in your application, edit the ``CSPEnabled`` value in
|
||||||
**application/Config/App.php**::
|
**app/Config/App.php**::
|
||||||
|
|
||||||
public $CSPEnabled = true;
|
public $CSPEnabled = true;
|
||||||
|
|
||||||
When enabled, the response object will contain an instance of ``CodeIgniter\HTTP\ContentSecurityPolicy``. The
|
When enabled, the response object will contain an instance of ``CodeIgniter\HTTP\ContentSecurityPolicy``. The
|
||||||
values set in **application/Config/ContentSecurityPolicy.php** are applied to that instance and, if no changes are
|
values set in **app/Config/ContentSecurityPolicy.php** are applied to that instance and, if no changes are
|
||||||
needed during runtime, then the correctly formatted header is sent and you're all done.
|
needed during runtime, then the correctly formatted header is sent and you're all done.
|
||||||
|
|
||||||
Runtime Configuration
|
Runtime Configuration
|
||||||
@ -440,7 +440,7 @@ The methods provided by the parent class that are available are:
|
|||||||
|
|
||||||
The prefix is only needed if you need to avoid name collisions with
|
The prefix is only needed if you need to avoid name collisions with
|
||||||
other identically named cookies for your server.
|
other identically named cookies for your server.
|
||||||
|
|
||||||
Provide a prefix if cookies should only be deleted for that subset.
|
Provide a prefix if cookies should only be deleted for that subset.
|
||||||
Provide a domain name if cookies should only be deleted for that domain.
|
Provide a domain name if cookies should only be deleted for that domain.
|
||||||
Provide a path name if cookies should only be deleted for that path.
|
Provide a path name if cookies should only be deleted for that path.
|
||||||
|
@ -440,7 +440,7 @@ See `PHP's NumberFormatter <http://php.net/manual/en/numberformatter.create.php>
|
|||||||
Custom Filters
|
Custom Filters
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
You can easily create your own filters by editing **application/Config/View.php** and adding new entries to the
|
You can easily create your own filters by editing **app/Config/View.php** and adding new entries to the
|
||||||
``$filters`` array. Each key is the name of the filter is called by in the view, and its value is any valid PHP
|
``$filters`` array. Each key is the name of the filter is called by in the view, and its value is any valid PHP
|
||||||
callable::
|
callable::
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ callable::
|
|||||||
PHP Native functions as Filters
|
PHP Native functions as Filters
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
You can easily use native php function as filters by editing **application/Config/View.php** and adding new entries to the
|
You can easily use native php function as filters by editing **app/Config/View.php** and adding new entries to the
|
||||||
``$filters`` array.Each key is the name of the native PHP function is called by in the view, and its value is any valid native PHP
|
``$filters`` array.Each key is the name of the native PHP function is called by in the view, and its value is any valid native PHP
|
||||||
function prefixed with::
|
function prefixed with::
|
||||||
|
|
||||||
|
@ -61,11 +61,11 @@ Enabling the Toolbar
|
|||||||
|
|
||||||
The toolbar is enabled by default in any environment *except* production. It will be shown whenever the
|
The toolbar is enabled by default in any environment *except* production. It will be shown whenever the
|
||||||
constant CI_DEBUG is defined and it's value is positive. This is defined in the boot files (i.e.
|
constant CI_DEBUG is defined and it's value is positive. This is defined in the boot files (i.e.
|
||||||
application/Config/Boot/development.php) and can be modified there to determine what environments it shows
|
app/Config/Boot/development.php) and can be modified there to determine what environments it shows
|
||||||
itself in.
|
itself in.
|
||||||
|
|
||||||
The toolbar itself is displayed as an :doc:`After Filter </incoming/filters>`. You can stop it from ever
|
The toolbar itself is displayed as an :doc:`After Filter </incoming/filters>`. You can stop it from ever
|
||||||
running by removing it from the ``$globals`` property of **application/Config/Filters.php**.
|
running by removing it from the ``$globals`` property of **app/Config/Filters.php**.
|
||||||
|
|
||||||
Choosing What to Show
|
Choosing What to Show
|
||||||
---------------------
|
---------------------
|
||||||
|
@ -216,7 +216,7 @@ parameter is the name of the property to set the value of. The third parameter i
|
|||||||
Mocking Services
|
Mocking Services
|
||||||
================
|
================
|
||||||
|
|
||||||
You will often find that you need to mock one of the services defined in **application/Config/Services.php** to limit
|
You will often find that you need to mock one of the services defined in **app/Config/Services.php** to limit
|
||||||
your tests to only the code in question, while simulating various responses from the services. This is especially
|
your tests to only the code in question, while simulating various responses from the services. This is especially
|
||||||
true when testing controllers and other integration testing. The **Services** class provides two methods to make this
|
true when testing controllers and other integration testing. The **Services** class provides two methods to make this
|
||||||
simple: ``injectMock()``, and ``reset()``.
|
simple: ``injectMock()``, and ``reset()``.
|
||||||
|
@ -24,7 +24,7 @@ you'll see URL patterns that match:
|
|||||||
As URL schemes become more complex, this may change. But for now, this
|
As URL schemes become more complex, this may change. But for now, this
|
||||||
is all we will need to know.
|
is all we will need to know.
|
||||||
|
|
||||||
Create a file at *application/Controllers/Pages.php* with the following
|
Create a file at *app/Controllers/Pages.php* with the following
|
||||||
code.
|
code.
|
||||||
|
|
||||||
::
|
::
|
||||||
@ -53,7 +53,7 @@ Now that you've created your first method, it's time to make some basic page
|
|||||||
templates. We will be creating two "views" (page templates) that act as
|
templates. We will be creating two "views" (page templates) that act as
|
||||||
our page footer and header.
|
our page footer and header.
|
||||||
|
|
||||||
Create the header at *application/Views/templates/header.php* and add
|
Create the header at *app/Views/templates/header.php* and add
|
||||||
the following code:
|
the following code:
|
||||||
|
|
||||||
::
|
::
|
||||||
@ -70,7 +70,7 @@ the following code:
|
|||||||
The header contains the basic HTML code that you'll want to display
|
The header contains the basic HTML code that you'll want to display
|
||||||
before loading the main view, together with a heading. It will also
|
before loading the main view, together with a heading. It will also
|
||||||
output the ``$title`` variable, which we'll define later in the controller.
|
output the ``$title`` variable, which we'll define later in the controller.
|
||||||
Now, create a footer at *application/Views/templates/footer.php* that
|
Now, create a footer at *app/Views/templates/footer.php* that
|
||||||
includes the following code:
|
includes the following code:
|
||||||
|
|
||||||
::
|
::
|
||||||
@ -84,7 +84,7 @@ Adding logic to the controller
|
|||||||
|
|
||||||
Earlier you set up a controller with a ``view()`` method. The method
|
Earlier you set up a controller with a ``view()`` method. The method
|
||||||
accepts one parameter, which is the name of the page to be loaded. The
|
accepts one parameter, which is the name of the page to be loaded. The
|
||||||
static page templates will be located in the *application/Views/pages/*
|
static page templates will be located in the *app/Views/pages/*
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
In that directory, create two files named *home.php* and *about.php*.
|
In that directory, create two files named *home.php* and *about.php*.
|
||||||
@ -166,7 +166,7 @@ controller you made above produces...
|
|||||||
- ``localhost:8080/pages/view/about`` will show the "about" page that you made above,
|
- ``localhost:8080/pages/view/about`` will show the "about" page that you made above,
|
||||||
because we explicitly asked for it
|
because we explicitly asked for it
|
||||||
- ``localhost:8080/pages/view/shop`` will show a "404 - File Not Found" error page,
|
- ``localhost:8080/pages/view/shop`` will show a "404 - File Not Found" error page,
|
||||||
because there is no `application/Views/pages/shop.php`
|
because there is no `app/Views/pages/shop.php`
|
||||||
|
|
||||||
|
|
||||||
Routing
|
Routing
|
||||||
@ -179,7 +179,7 @@ controller and method, and break free from the normal convention:
|
|||||||
``http://example.com/[controller-class]/[controller-method]/[arguments]``
|
``http://example.com/[controller-class]/[controller-method]/[arguments]``
|
||||||
|
|
||||||
Let's do that. Open the routing file located at
|
Let's do that. Open the routing file located at
|
||||||
*application/Config/Routes.php* and look for the "Route Definitions"
|
*app/Config/Routes.php* and look for the "Route Definitions"
|
||||||
section of the configuration file.
|
section of the configuration file.
|
||||||
|
|
||||||
The only uncommented line there to start with should be:::
|
The only uncommented line there to start with should be:::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user