Download the PHP package jijihohococo/ichi-template without Composer
On this page you can find all versions of the php package jijihohococo/ichi-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ichi-template
ICHI PHP TEMPLATE
ICHI PHP TEMPLATE is the fast and secure Pure PHP Template Library
License
This package is Open Source According to MIT license
Table Of Contents
- ICHI PHP TEMPLATE
- License
- Table Of Contents
- Acknowledgement
- Installation
- Set Up Template Base Directory Path
- Showing Views
- Showing Error Messages
- Showing Success Messages
- Section And Content
- Sharing Data In All Views
- Preventing XSS Attack
- Components
- Show Old Request Data
Acknowledgement
I really thanks to my mother for everything. She is the best for me.
Installation
Set Up Template Base Directory Path
You can set up the base directory path for your all template view files.
It is highly recommend to set up template base directory path before using functions of ICHI TEMPLATE
The base directory path will be used in calling all views
It doesn't matter if you want to use another base directory path name.
After setting template base path for views, you can directly call the files under this base path directly.
For example,you have 'show_data.php' under your template base path.
You can directly call this file in showing views directly without including directory path if you had set template base path.
Showing Views
You can show the views in your function like that
You must include full directory path if you don't set up the template base path
Using 'view' function can only apply section and content template style in that called view php file.
Without Data
With Data
You can also call your php file without '.php' file extension
You can use called data in your view file which is calling from "view" function
In your_view_php_file_path
If you don't want to use template system but want to show only the views. You can do as shown as below
You can also use following functions within your view php file which is called from 'view' function
Without Data
With Data
You can also call your php file without '.php' file extension
'includeView' function will show the file by using 'include' function 'includeOnceView' function will show the by using 'include_once' function 'requireView' function will show the file by using 'require' function 'requireOnceView' function will show the file by using 'require_once' function
Showing Error Messages
You can add error messages
You can get error messages with 'errors' array variable in your view php files
Showing Success Messages
You can add success messages
You can get sucess messages with 'success' array variable in your view php views
Section And Content
You can apply template system as shown as below
Firstly, you must show your view php file
In your template main php file
In your view php file
You can also call your php file without '.php' file extension
In your view php file, You must call your template main php file with 'extend' function firstly. You must add 'content' name in your 'section' function. After using 'section' function and write your frontend stuffs you must use 'endSection' function
In your template main php file, you must call 'y' function with the content name that you want to show.
Both view php file and main layout file will be shown.
If you want to change page title dynamicatlly according to view php file
In your view php file
In your template main php file
Sharing Data In All Views
You can share the data (variables) in all your views
And calling 'view' function
You can use the share data as variables in your view php file
Preventing XSS Attack
You can prevent your string data output from xss attack
Components
You can use class as your component to show view php files
In your component class
You can create the component class with the commandline.
Firstly you need to created the file named "ichi" under your project folder and use the below code in this file
And then you can create the component in your commandline
The default file folder is "app/Components". So after making command, the component you created will be in the this default file folder. If you want to change the default folder path, you can change it in your "ichi" file.
In your view php file, you can now call your component
You can use constructor in your component class to pass the data
In your component class
In your view php file
You can set the base directory path for your component classes.
So you can call only component class name when you use 'component' function
Show Old Request Data
You can show old request data after submitting in your php file
If you want to set default data if the request is not isset
This function is aimed to use in create and update data forms.