Creating Custom Templates
Step 1: Choose a Descriptive Name
Select a name that clearly indicates the template's purpose. For example:
- members_area
- admin_dashboard
- product_catalog
Step 2: Create a Controller Method
Open the 'Templates.php' controller file in the 'templates' module and add a new method for your template:
function members_area($data = []) {
load('members_area', $data);
}
The method name should match your template name. The $data
parameter allows for passing variables to the template.
Step 3: Create the Template View File
Create a new file in the 'views' directory of the 'templates' module. The file name should match your template name (e.g., 'members_area.php').
Design your template according to your project's needs, including placeholders for dynamic content.