Download the PHP package seunex17/codeigniter4-smarty without Composer
On this page you can find all versions of the php package seunex17/codeigniter4-smarty. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download seunex17/codeigniter4-smarty
More information about seunex17/codeigniter4-smarty
Files in seunex17/codeigniter4-smarty
Package codeigniter4-smarty
Short Description A smarty template engine for Codeigniter4
License MIT
Informations about the package codeigniter4-smarty
Smarty template engine for Codeigniter 4.
Easily implement the Smarty templating engine in your CodeIgniter 4 project.
Description
Separate the application logic from your presentation layer in CodeIgniter 4 using this clean and semantic pre-built Smarty template.
Requirements
- Codeigniter 4.x
- Smarty 5.x
Installation
Installation is best done via Composer, you may use the following command:
This will simply add the latest release of ci4-smarty as a module to your project.
Example:
By default without any additonal configuration this library will look into Views/templates/default for you template files.
Here is an example of basic usage:
- PHP:
If you view file is in a sub directory e.g Views/dashboard/test.tpl you can load you view file like below example
- PHP:
To pass data from the Controller to the View:
-
PHP:
- View
app/Views/test.tpl
Using native and custom php function in views
As at smarty v5 usage of native and custom php function as been removed. Should we need to use function in our views we need to register this functions and tell smarty we intended to use this functions.
- Publish the Smartie core config into your app
You publish fiel should now be located at app/Configs/Smartie.php
-
Register you function
- Declare global variables
To learn more about the smarty tag you can check out the smarty official documentation here: https://smarty-php.github.io/smarty/stable/
Contributing:
All contributions are extremely appreciated.
All versions of codeigniter4-smarty with dependencies
codeigniter4/framework Version ^4.0
codeigniter4/settings Version ^2.2
smarty/smarty Version ^5.0