Bonfire includes a Template library which makes it easier to build pages for a website based on layouts and partial views.
Additional information about using the Template library may be found in Layouts and Views.
The Template library can be configured by setting several values in /application/config/application.php
.
The path to the root folder that holds the application.
This does not have to be the site root folder, or even the folder defined in FCPATH.
$config['template.site_path'] = FCPATH;
An array of folders to look in for themes.
There must be at least one folder path at all times, to serve as the fall-back for when a theme isn't found.
Paths are relative to the template.site_path
.
$config['template.theme_paths'] = array('themes');
This is the name of the default layout used if no others are specified.
NOTE: do not include an ending ".php" extension.
$config['template.default_layout'] = "index";
This is the name of the default layout used when the page is displayed via an AJAX call.
NOTE: do not include an ending ".php" extension.
$config['template.ajax_layout'] = 'ajax';
When set to true, the Template library will check the user agent during the rendering process against the template.themes
, allowing you to create mobile versions of your site, and versions targetted specifically at a single type of phone (ie, Blackberry or iPhone).
NOTE: when rendering, if the file doesn't exist in the targetted theme, the Template library then checks the default site for the same file.
$config['template.use_mobile_themes'] = false;
This is the folder name that contains the default theme to use when searching for a view in your site's themes.
$config['template.default_theme'] = 'default/';
This is the folder name that contains the default theme to use for the site's admin area (SITE_AREA
).
$config['template.admin_theme'] = 'admin';
This is the template that the Template library will use when displaying messages through the message() function.
To set the class for the type of message (error, success, etc), the {type}
placeholder will be replaced.
The message will replace the {message}
placeholder.
$config['template.message_template'] =<<<EOD
<div class="alert alert-block alert-{type} fade in notification">
<a data-dismiss="alert" class="close" href="#">×</a>
<div>{message}</div>
</div>
EOD;
Breadcrumb separator, the symbol displayed between the breadcrumb elements.
$config['template.breadcrumb_symbol'] = ' : ';
If set to true, views will be parsed via CodeIgniter's parser.
If false, views will be considered PHP views only.
$config['template.parse_views'] = false;
Add a theme path ($path
) to the list of paths to be used when searching for themed views.
Places a named block in the layout/view which acts as an insertion point for a view.
This is ideal for setting locations for recurring elements within a site's layout, such as sidebars, headers, footers, etc.
$block_name
is the name used to reference this block, especially when calling set_block()
to change/set the view.$default_view
is set to the path/name of an existing view, the view will be used if no other view is set (by calling set_block()
).$data
may be set to pass an array of data to the view rendered in the block.$themed
:true
, the view will be loaded from the current theme, if possible.false
(default), the view will be loaded from the standard view locations.Specifies the area in the layout into which the current view will be rendered.
Returns a string containing the output of the render process for the view.
Returns the value of a variable which has been previously set, or false if the variable does not exist.
Returns the layout into which views will be rendered.
Used to initialize the Template library after it is loaded by CodeIgniter.
Not intended for external use, despite being a public method.
Load a view from the current theme.
- $view
the name of the view to load.
- $data
An optional array of data elements to be made available to the views. Array keys will be the variable names used to access the values in the view.
- $override
An optional string containing the name of a view to override $view
, if available.
- $is_themed
An optional boolean value (defaults to true
) to determine whether themes are checked when attempting to locate a view.
- &$output
A reference to a variable to store the output of the loaded view.
Displays a status message.
- If $message
is not included, displays a message set previously via either set_message()
or session->flashdata('message')
. Otherwise, displays $message
.
- $type
is the type of message (defaults to 'information'
), usually added as a value of the class attribute on the message's container. This value is only used if not already set on the message to be displayed.
Sets the $parse_views
property, which controls whether views will be parsed by CI's Parser.
- If $parse
is true
, the views will be parsed.
- If false
(default), they will not be parsed by CI's Parser.
Performs a redirect, similar to CodeIgniter's redirect()
, but, if it detects that this is in response to an AJAX request, it will inject a JavaScript redirect into the response.
- $url
is an optional URL to which the user will be redirected. If omitted, it will be set to the site's base URL.
Starts the process of rendering the page content and determines the correct view to use based on the current controller/method.
Optionally, $layout
may be set to the path/name of a layout to use instead of the current layout.
This method is usually called in the last line of most controller actions/methods (except when those methods return data for use by another controller or in response to an AJAX call).
Set a value or an array of values to be provided to the view(s) in the content area.
$var_name
can be an array of key/value pairs (with the key being the variable name to be used in the view), in which case $value
should be omitted.$var_name
is a string, it will be interpreted as the name of a variable to be set to $value
in the view.Specify the layout into which the views will be rendered.
Allows overriding the default layout.
This is especially useful to set a default layout for a controller which overrides the default layout of the application.
This method is used to override the default view (or set a view if no default was provided) in a named block.
- $block_name
must match the value passed in the first parameter of the block()
method. The name of the block.
- $view_name
is the path/name of the view to render in the block.
Set the default theme ($theme
) to use in case a view is not found in the active theme.
This theme should be relative to one of the current theme paths.
Sets a status message (primarily intended for displaying small success/error messages).
This function is used in place of session->flashdata
to allow the message to show up without requiring a page refresh.
$message
is the text of the message.$type
is the type of message (defaults to 'info'
), usually added as a value of the class attribute on the message's container.Set the name of the active theme ($theme
).
This theme should be relative to one of the current theme paths.
The optional $default_theme
allows you to also set a default theme to use in case a view is not found in the active theme.
Sets the view to be rendered in the content block.
Enable/disable the library's use of sessions.
This is primarily used by the installer (when sessions are not likely to be available), but is also useful for testing.
If $useSession
is true
, the library will use sesssions; if false
, the library will not use sessions.
Returns the name of the active theme.
Returns the full URL to the currently active theme.
If $resource
is supplied, returns the full URL to that resource within the currently active theme (does not validate the existence of the resource within the theme).
Set an insertion point for a view ($view
) within a view.
- $view
: The name of the view to be rendered.
- $data
: An array of data to be passed to the view.
- $ignore_mobile
:
- If true
, the library will not attempt to find a version of this view named for mobile devices (prefixed with mobile_
).
- If false
(default), the library will attempt to find a version of this view named for mobile devices when it detects that the page is being accessed from a mobile device.
Remove a theme path ($path
) from the list of paths to be used when searching for themed views.
Helper functions are not methods of the Template library (so they are called without using the Template::
prefix).
They are included automatically when loading the Template library.
Creates a breadcrumb from either uri->segments
or a key/value paired array passed via $my_segments
.
- If $wrap
is true
, the breadcrumbs will be wrapped in an un-ordered list (default is false
).
- If $echo
is true
(default), the output is sent to echo
, if false
, the output will be returned.
If the current class/controller name matches $item
(in a case-insensitive comparison), this function returns 'class="active"'
if $class_only
is false
(default) or 'active'
if $class_only
is true
.
If $item
does not match, an empty string is returned.
This (and the other check_*
helper functions in the Template library) is intended primarily for use in menus and other areas of the page to help indicate the active page or active site area, especially when using blocks to display a single view for a portion of the layout displayed on multiple pages.
If the current method (controller action) matches $item
, this function returns 'class="active"'
if $class_only
is false
(default) or 'active'
if $class_only
is true
.
If $item
does not match, an empty string is returned.
Checks the value of $item
against the value of the specified URI segment ($segment_num
).
If they match, the function returns 'class="active"'
if $class_only
is false
(default) or 'active'
if $class_only
is true
.
If $item
does not match, an empty string is returned.
Set an insertion point for a view ($view
) within a view.
A helper function for Template::themeView()
.
An array of named blocks and the path/filename of the view for each block.
A boolean value which controls the library's output of debug messages.
A boolean value which disables the library's use of sessions, primarily for unit testing.
Use setSessionUse()
instead. Note that setSessionUse()
expects the opposite value of $ignore_session
, so setSessionUse(false)
is equivalent to setting $ignore_session = true
.
The layout into which views will be rendered.
Use getLayout()
and setLayout()
instead.
A boolean value which determines whether CI's Parser will be used to parse the views.
The full server path to the site root.
Events::trigger('after_layout_render', $output);
Triggered near the end of the render()
method, before calling output->set_output($output)
.
Events::trigger('after_page_render', $output);
Triggered near the end of the content()
method, before returning $output
.
1 ms | Loading Time: Base Classes |
11 ms | Controller Execution Time ( Docs / Index ) |
15 ms | Total Execution Time |
0.0002 | SELECT GET_LOCK('7169b76e26398f03b4eac60a3ee33c27', 300) AS ci_session_lockSpeed: 0.0002 - Possible keys: - Key Used: - Type: - Rows: - Extra: No tables used |
0.0003 | SELECT `data` FROM `bf_ci_sessions` WHERE `id` = 'cgiqrjb0ns1dvl276ochjj7v3r03878g' and `ip_address` = '18.119.133.214'Speed: 0.0003 - Possible keys: - Key Used: - Type: - Rows: - Extra: Impossible WHERE noticed after reading const tables |
0.0004 | SHOW TABLES FROM `bonfire` |
0.0002 | SELECT * FROM `bf_settings`Speed: 0.0002 - Possible keys: - Key Used: - Type: ALL - Rows: 42 - Extra: |
0.0011 | Total Query Execution Time |
__ci_last_regenerate | 1734910129 |
requested_page | https://kampensonline.com/docs/developer/template |
previous_page | https://kampensonline.com/docs/developer/template |
No GET data exists |
No POST data exists |
docs/developer/template |
docs/index |
HTTP_ACCEPT | */* |
HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) |
HTTP_CONNECTION | |
SERVER_PORT | 443 |
SERVER_NAME | kampensonline.com |
REMOTE_ADDR | 18.119.133.214 |
SERVER_SOFTWARE | Apache/2.4.62 (Ubuntu) |
HTTP_ACCEPT_LANGUAGE | |
SCRIPT_NAME | /index.php |
REQUEST_METHOD | GET |
HTTP_HOST | |
REMOTE_HOST | |
CONTENT_TYPE | |
SERVER_PROTOCOL | HTTP/1.1 |
QUERY_STRING | |
HTTP_ACCEPT_ENCODING | gzip, br, zstd, deflate |
HTTP_X_FORWARDED_FOR |
domain | kampensonline.com |
base_url | https://kampensonline.com |
index_page | |
uri_protocol | AUTO |
url_suffix | |
language | english |
charset | UTF-8 |
enable_hooks | true |
subclass_prefix | MY_ |
composer_autoload | false |
permitted_uri_chars | a-z 0-9~%.:_- |
allow_get_array | true |
enable_query_strings | false |
controller_trigger | c |
function_trigger | m |
directory_trigger | d |
log_threshold | 4 |
log_path | /var/www/htdocs/bonfire/application/logs/ |
log_file_extension | |
log_file_permissions | 436 |
log_date_format | Y-m-d H:i:s |
error_views_path | |
cache_path | /var/www/htdocs/bonfire/application/cache/ |
cache_query_string | false |
encryption_key | 92b35b02920621aedbed3b8b9a68c0f1 |
sess_cookie_name | bf_session |
sess_expiration | 7200 |
sess_time_to_update | 300 |
sess_match_ip | true |
sess_driver | database |
sess_regenerate_destroy | false |
sess_save_path | ci_sessions |
cookie_prefix | |
cookie_domain | kampensonline.com |
cookie_path | / |
cookie_secure | false |
cookie_httponly | true |
cookie_samesite | Strict |
standardize_newlines | false |
csrf_protection | true |
csrf_token_name | ci_csrf_token |
csrf_cookie_name | ci_csrf_token |
csrf_expire | 7200 |
csrf_regenerate | true |
csrf_exclude_uris | Array ( ) |
compress_output | false |
time_reference | local |
rewrite_short_tags | false |
proxy_ips | |
bonfire.installed | 1 |
site.default_user_timezone | UP12 |
modules_locations | Array ( [/var/www/htdocs/bonfire/application/modules/] => ../../application/modules/ [/var/www/htdocs/bonfire/bonfire/modules/] => ../../bonfire/modules/ ) |
site.backup_folder | archives/ |
contexts | Array ( [0] => content [1] => reports [2] => settings [3] => developer ) |
enable_activity_logging | true |
sparks_path | ../sparks/ |
template.site_path | /var/www/htdocs/bonfire/public/ |
template.theme_paths | Array ( [0] => themes ) |
template.default_layout | index |
template.ajax_layout | ajax |
template.use_mobile_themes | false |
template.default_theme | default/ |
template.admin_theme | admin |
template.message_template | <div class="alert alert-{type} alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> <div>{message}</div> </div> |
template.breadcrumb_symbol | : |
template.parse_views | false |
assets.directories | Array ( [base] => assets [cache] => cache [css] => css [image] => images [js] => js [module] => module ) |
assets.js_opener | $(document).ready(function() { |
assets.js_closer | }); |
assets.css_combine | false |
assets.js_combine | false |
assets.css_minify | true |
assets.js_minify | true |
assets.encrypt_name | false |
assets.encode | false |
assets.base_folder | assets |
assets.asset_folders | Array ( [css] => css [js] => js [image] => images ) |
ui.current_shortcuts | Array ( [form_save] => Array ( [description] => Save any form in the admin area. [action] => $("input[name=save]").click();return false; ) [create_new] => Array ( [description] => Create a new record in the module. [action] => window.location.href=$("a#create_new").attr("href"); ) [select_all] => Array ( [description] => Select all records in an index page. [action] => $("table input[type=checkbox]").click();return false; ) [delete] => Array ( [description] => Delete the record(s). [action] => $("#delete-me.btn-danger").click(); ) [module_index] => Array ( [description] => Return to the index of the current module. [action] => window.location.href=$("a#list").attr("href"); ) [goto_content] => Array ( [description] => Jump to the Content context. [action] => window.location.href=$("#tb_content").attr("href") ) [goto_reports] => Array ( [description] => Jump to the Reports context. [action] => window.location.href=$("#tb_reports").attr("href") ) [goto_settings] => Array ( [description] => Jump to the Settings context. [action] => window.location.href=$("#tb_settings").attr("href") ) [goto_developer] => Array ( [description] => Jump to the Developer context. [action] => window.location.href=$("#tb_developer").attr("href") ) ) |
emailer.write_to_file | false |
migrate.auto_core | false |
migrate.auto_app | false |
commonmark.valid_drivers | Array ( [0] => Parsedown [1] => Markdown [2] => MarkdownExtra [3] => LeagueCommonMark ) |
commonmark.driver | MarkdownExtended |
docs.theme | docs |
docs.default_group | developer |
docs.show_dev_docs | true |
docs.show_app_docs | true |
docs.toc_file | _toc.ini |
docs.permitted_environments | Array ( [0] => development [1] => testing [2] => production ) |
application.php /var/www/htdocs/bonfire/application/config/application.php |
autoload.php /var/www/htdocs/bonfire/application/config/autoload.php |
config.php /var/www/htdocs/bonfire/application/config/config.php |
constants.php /var/www/htdocs/bonfire/application/config/constants.php |
database.php /var/www/htdocs/bonfire/application/config/database.php |
events.php /var/www/htdocs/bonfire/application/config/events.php |
hooks.php /var/www/htdocs/bonfire/application/config/hooks.php |
mimes.php /var/www/htdocs/bonfire/application/config/mimes.php |
profiler.php /var/www/htdocs/bonfire/application/config/profiler.php |
routes.php /var/www/htdocs/bonfire/application/config/routes.php |
Base_Controller.php /var/www/htdocs/bonfire/application/core/Base_Controller.php |
MY_Model.php /var/www/htdocs/bonfire/application/core/MY_Model.php |
App_hooks.php /var/www/htdocs/bonfire/application/hooks/App_hooks.php |
application_lang.php /var/www/htdocs/bonfire/application/language/english/application_lang.php |
Profiler.php /var/www/htdocs/bonfire/application/libraries/Profiler.php |
Base.php /var/www/htdocs/bonfire/application/third_party/MX/Base.php |
Config.php /var/www/htdocs/bonfire/application/third_party/MX/Config.php |
Controller.php /var/www/htdocs/bonfire/application/third_party/MX/Controller.php |
Lang.php /var/www/htdocs/bonfire/application/third_party/MX/Lang.php |
Loader.php /var/www/htdocs/bonfire/application/third_party/MX/Loader.php |
Benchmark.php /var/www/htdocs/bonfire/bonfire/ci3/core/Benchmark.php |
CodeIgniter.php /var/www/htdocs/bonfire/bonfire/ci3/core/CodeIgniter.php |
Common.php /var/www/htdocs/bonfire/bonfire/ci3/core/Common.php |
Config.php /var/www/htdocs/bonfire/bonfire/ci3/core/Config.php |
Controller.php /var/www/htdocs/bonfire/bonfire/ci3/core/Controller.php |
Hooks.php /var/www/htdocs/bonfire/bonfire/ci3/core/Hooks.php |
Input.php /var/www/htdocs/bonfire/bonfire/ci3/core/Input.php |
Lang.php /var/www/htdocs/bonfire/bonfire/ci3/core/Lang.php |
Loader.php /var/www/htdocs/bonfire/bonfire/ci3/core/Loader.php |
Log.php /var/www/htdocs/bonfire/bonfire/ci3/core/Log.php |
Model.php /var/www/htdocs/bonfire/bonfire/ci3/core/Model.php |
Output.php /var/www/htdocs/bonfire/bonfire/ci3/core/Output.php |
Router.php /var/www/htdocs/bonfire/bonfire/ci3/core/Router.php |
Security.php /var/www/htdocs/bonfire/bonfire/ci3/core/Security.php |
URI.php /var/www/htdocs/bonfire/bonfire/ci3/core/URI.php |
Utf8.php /var/www/htdocs/bonfire/bonfire/ci3/core/Utf8.php |
hash.php /var/www/htdocs/bonfire/bonfire/ci3/core/compat/hash.php |
mbstring.php /var/www/htdocs/bonfire/bonfire/ci3/core/compat/mbstring.php |
password.php /var/www/htdocs/bonfire/bonfire/ci3/core/compat/password.php |
standard.php /var/www/htdocs/bonfire/bonfire/ci3/core/compat/standard.php |
DB.php /var/www/htdocs/bonfire/bonfire/ci3/database/DB.php |
DB_driver.php /var/www/htdocs/bonfire/bonfire/ci3/database/DB_driver.php |
DB_query_builder.php /var/www/htdocs/bonfire/bonfire/ci3/database/DB_query_builder.php |
DB_result.php /var/www/htdocs/bonfire/bonfire/ci3/database/DB_result.php |
mysqli_driver.php /var/www/htdocs/bonfire/bonfire/ci3/database/drivers/mysqli/mysqli_driver.php |
mysqli_result.php /var/www/htdocs/bonfire/bonfire/ci3/database/drivers/mysqli/mysqli_result.php |
directory_helper.php /var/www/htdocs/bonfire/bonfire/ci3/helpers/directory_helper.php |
form_helper.php /var/www/htdocs/bonfire/bonfire/ci3/helpers/form_helper.php |
language_helper.php /var/www/htdocs/bonfire/bonfire/ci3/helpers/language_helper.php |
url_helper.php /var/www/htdocs/bonfire/bonfire/ci3/helpers/url_helper.php |
profiler_lang.php /var/www/htdocs/bonfire/bonfire/ci3/language/english/profiler_lang.php |
Cache.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Cache/Cache.php |
Cache_dummy.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Cache/drivers/Cache_dummy.php |
Driver.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Driver.php |
CI_Session_driver_interface.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Session/CI_Session_driver_interface.php |
PHP8SessionWrapper.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Session/PHP8SessionWrapper.php |
Session.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Session/Session.php |
Session_driver.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Session/Session_driver.php |
Session_database_driver.php /var/www/htdocs/bonfire/bonfire/ci3/libraries/Session/drivers/Session_database_driver.php |
BF_Loader.php /var/www/htdocs/bonfire/bonfire/core/BF_Loader.php |
BF_Router.php /var/www/htdocs/bonfire/bonfire/core/BF_Router.php |
BF_directory_helper.php /var/www/htdocs/bonfire/bonfire/helpers/BF_directory_helper.php |
BF_form_helper.php /var/www/htdocs/bonfire/bonfire/helpers/BF_form_helper.php |
application_helper.php /var/www/htdocs/bonfire/bonfire/helpers/application_helper.php |
config_file_helper.php /var/www/htdocs/bonfire/bonfire/helpers/config_file_helper.php |
markdown_extended_helper.php /var/www/htdocs/bonfire/bonfire/helpers/markdown_extended_helper.php |
markdown_helper.php /var/www/htdocs/bonfire/bonfire/helpers/markdown_helper.php |
Assets.php /var/www/htdocs/bonfire/bonfire/libraries/Assets.php |
BF_Model.php /var/www/htdocs/bonfire/bonfire/libraries/BF_Model.php |
CommonMark.php /var/www/htdocs/bonfire/bonfire/libraries/CommonMark.php |
CommonMarkDriver.php /var/www/htdocs/bonfire/bonfire/libraries/CommonMark/CommonMarkDriver.php |
CommonMark_MarkdownExtended.php /var/www/htdocs/bonfire/bonfire/libraries/CommonMark/drivers/CommonMark_MarkdownExtended.php |
Console.php /var/www/htdocs/bonfire/bonfire/libraries/Console.php |
Events.php /var/www/htdocs/bonfire/bonfire/libraries/Events.php |
Modules.php /var/www/htdocs/bonfire/bonfire/libraries/Modules.php |
Route.php /var/www/htdocs/bonfire/bonfire/libraries/Route.php |
Template.php /var/www/htdocs/bonfire/bonfire/libraries/Template.php |
docs.php /var/www/htdocs/bonfire/bonfire/modules/docs/config/docs.php |
routes.php /var/www/htdocs/bonfire/bonfire/modules/docs/config/routes.php |
Docs.php /var/www/htdocs/bonfire/bonfire/modules/docs/controllers/Docs.php |
docs_lang.php /var/www/htdocs/bonfire/bonfire/modules/docs/language/english/docs_lang.php |
_sidebar.php /var/www/htdocs/bonfire/bonfire/modules/docs/views/_sidebar.php |
index.php /var/www/htdocs/bonfire/bonfire/modules/docs/views/index.php |
Settings_lib.php /var/www/htdocs/bonfire/bonfire/modules/settings/libraries/Settings_lib.php |
Settings_model.php /var/www/htdocs/bonfire/bonfire/modules/settings/models/Settings_model.php |
index.php index.php |
index.php themes/docs/index.php |