Download the PHP package tatter/layouts without Composer
On this page you can find all versions of the php package tatter/layouts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tatter/layouts
More information about tatter/layouts
Files in tatter/layouts
Package layouts
Short Description Layout management service for CodeIgniter 4
License MIT
Homepage https://github.com/tattersoftware/codeigniter4-layouts
Informations about the package layouts
Tatter\Layouts
Layout management service for CodeIgniter 4
Description
This library provides a commons means of managing View Layouts across package modules and applications.
Installation
Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:
> composer require tatter/layouts
Or, install manually by downloading the source files and adding the directory to
app/Config/Autoload.php
.
Configuration
The code of Layouts
amounts to a single config file: Tatter\Layouts\Config\Layouts
. This
file provides the path for each layout as a property. Initially the config file only
includes a single property: "default". By supplying your own path via an App
config file
you can direct any package or module using Layouts
to use your layout instead. For example,
app/Config/Layouts.php:
Usage
To use the configured layout, simply provide the config property to your view file:
You can use any layout name you have configured, and any name that does not match will fall back on the path supplied for "default".
See the CodeIgniter User Guide to read more on View Layouts
Layout Expectations
For consistency this library assumes that the "default" template will have the following sections:
- headerAssets: The last section prior to the closing
</head>
tag, available for adding CSS tags and the like. - navbar: A navigation menu, typically to be displayed along the top of the page.
- main: The main content for the page (can include nested views, etc).
- footerASsets: The last section prior to the closing
</body>
tag, available for adding JS tags and footer content.
Default Layout
While it is highly recommended that you supply your own "default" layout, this library includes
a generic one as a fallback. This layout is based on the Bootstrap Starter Template
and includes CDN tags for Bootstrap CSS and JS. In addition to fulfilling the expectations above,
the layout also accepts the following variables to configure the HTML <head>
data:
- $headerDescription
- $headerAuthor
- $headerTitle