How To Create A LiteCart Template
Layout files = Files that draw everything around the content of a page. E.g. Header, body, footer.
Page files = Main content for each and every page.
View files = Boxes and partials that are included in pages and layouts.
Create A New Template
Copy the folder ~/includes/templates/default.catalog/ and all of it's contents to a new folder e.g. ~/includes/templates/mytheme.catalog/.
Clear the contents of the subdirectory pages/ and views/. This is because LiteCart will fetch views from the default view files if there are none in the new template. Basically we just want to store the views we are overriding inside the new template.
Activate the new theme in Admin → Appearance.
Use A Different Layout For The Start Page
Create a new layout file named ~/includes/templates/mytheme.catalog/layouts/index.inc.php.
Open up the defining page ~/pages/index.inc.php and insert the following code:
<?php
document::$layout = 'index';
?>
How To Find Specific CSS Stylings
Web browsers today comes with a set of handy developer tools.
Right click the element you want to style and select Inspect Element.
Look at the style definitions shown on the side. It will tell you which LESS file and line the rule is stated. More information about the developer tools be found in
https://developer.chrome.com/devtools.
We recommend reading the article How to change the look of your store regarding LESS files.
Template Settings
You have probably noticed the config file inside the template. It enables you to create a settings structure that can be controlled from the admin interface. Bascially it uses the same functionality as the modules do. Example goes:
$template_config = [
[
'key' => 'background',
'default_value' => '#fff',
'title' => language::translate('title_background', 'Background'),
'description' => language::translate('description_background', 'A CSS background value'),
'function' => 'text()',
],
];
Note: For more 'function' options you can look at the function “form_draw_function()” found in the file “func_form.inc.php”.
To call this value use the following in a template layout:
<style>
body {
background: <?php echo document::$settings['background']; ?>;
}
</style>
Note: The settings values are reset once the template is changed to another template.