Microweber templates are a set of files that determines the overall look of a website. These files are used to generate the site layout and the html code.
You can use PHP and HTML to make your template as flexible as you need it to be.
All templates are located into
userfiles/templates directory. Each template is contained within its own folder and you need to create a new folder when creating a new template. Usually, the name of the folder is given the name of your new template.
Template folders must be in lower-case and must not contain spaces or special characters.
Here is the most basic template structure
userfiles /templates /my_template config.php header.php index.php footer.php clean.php
Basic files and their purpose
|config.php||holds the information for your template, like name, version|
|index.php||homepage default layout|
|clean.php||default layout for page|
|inner.php||default layout for post|
Here is example config file you must create in your template folder
Set template name, author and version
config.php file must contain a
$config array with the following information.
<?php $config = array(); $config['name'] = "My template"; $config['author'] = "Your name"; $config['version'] = 0.1; $config['url'] = "http://example.com/";
The config file defines the name of your template as it will appear in the "Template selection" menu and in the "Settings" area.
The version parameter is optional and its used if you want to offer updates.
To add some basic styling, please create a css/ folder inside your theme folder and add some CSS in css/theme.css
Adding modules in your template
You can add a module in your template if you want to show dynamic content or work with some custom functionality
The modules are added with
<module type="name_of_your_module" />
Template functions and constants
| Constant | Value |
PAGE_ID | The id of the current page or 0 if page is not found |
POST_ID | The id of the current post or 0 if you are not in a post |
CATEGORY_ID | The id of the current category or 0 if you are not in a category |
MAIN_PAGE_ID | The id of the parent page if you are in a subpage |
ROOT_PAGE_ID | The id of the root parent page if you are in deep sub-page |
||Array of the current content item, it can be page or post|
||Array with the data for the current page|
||Array with the data for the current post|
The editable regions are the places where the users can drag and drop modules and edit content in real time.
You can define as few or as many regions that you like
Every layout can have many editable regions.
How to make editable regions
You can define editable regions in your template where the user will be able to type text and Drag and Drop modules The content of this region will be dynamic and will be editable on every layout that includes it.
Here is how it looks like:
<div class="edit" field="your_region_name" rel="content"> <p>Edit your content</p> </div>