Installation & configuration

Please note: This page is under construction and has not been finished yet.

Introduction

TODO:

  • overview of install & config files (theme.xml & theme_config.php)

  • highlight some options

  • refer to example themes (bootstrap3)

theme.xml

This file contains information about the theme. and is used during installation and also during configuration of the theme.

Please note: Unlike plugin.xml, the theme.xml file is not intended to replace the theme.php file. Instead, theme.xml works alongside theme.php to provide (meta)data about the theme itself.

Example#1: Full theme.xml

The below example uses the theme.xml from the Bootstrap3 theme included in e107 by default. Each section of the XML file is elaborated upon below.

<?xml version="1.0" encoding="utf-8"?>
<e107Theme name="Bootstrap 3" version="1.0" date="2013-12-25" compatibility="2.0">
	<author name="e107 Inc" email="e107inc@something.com" url="http://e107.org" />
	<summary>Bootstrap3 e107 theme</summary>
	<description>a simple bootstrap 3 template for the frontend</description>
	<category>generic</category>
	<plugins>
		<plugin name='featurebox' url='core' />
		<plugin name='gallery' url='core' />
        <plugin name='rss_menu' url='core' />
        <plugin name='tinymce4' url='core' />
		<plugin name='social' url='core' />
	</plugins>
	<keywords>
		<word>bootstrap</word>
		<word>clean</word>
	</keywords>
	<screenshots>
		<image>preview_frontend.png</image>
	</screenshots>
	<libraries>
		<library name="bootstrap" version="3" scope="front,admin,wysiwyg"/>
		<library name="fontawesome" version="5"  scope="front,admin,wysiwyg"/>
		<library name="bootstrap.editable" scope="admin"/>
	</libraries>
	<stylesheets>
		<css file="style.css" name="Default" scope="front" />
		<css file="css/modern-light.css" name="Modern Light" description="A high-contrast light skin" thumbnail='images/admin_modern-light.webp' scope='admin' exclude='bootstrap'/>
	</stylesheets>
	<layouts>
		<layout name='jumbotron_home' title='Jumbotron (home)' default='false'>
			<custompages>FRONTPAGE</custompages>	
		</layout>
		<layout name='modern_business_home' title='Modern Business: Home page carousel with fixed custom-menus' />
		<layout name='jumbotron_full' title='Jumbotron (full-width)'  >
      <custompages>forum</custompages>
		</layout>
		<layout name='jumbotron_sidebar_right' title='Jumbotron (sidebar-right)' default='true' >
			<custompages>/news</custompages>
			<menuPresets>
				<area id='1'>
					<menu name='search' />
					<menu name='news_categories' />
					<menu name='other_news' />
					<menu name='other_news2' />
					<menu name='blogcalendar' />
				</area>
			</menuPresets>	
		</layout>
	</layouts>
	<themePrefs>
		<pref name='branding'>sitename</pref>
		<pref name='nav_alignment'>right</pref>
		<pref name='usernav_placement'>top</pref>
	</themePrefs>
</e107Theme>

Example #2: Minimal theme.xml

TODO: Provide minimal required theme.xml example

e107Theme

This is the namespace the configuration lives in. All theme.xml files must begin and end with this tag.

<e107Theme name="" version="3.0" date="2012-01-07" compatibility="2.0">
... all content belongs here ...
</e107Theme>

The following attributes of the theme are defined here:

In previous versions of e107, the attribute releaseUrl was used. This attribute is deprecated and should be removed.

Author

Identifies the theme author and highlights some information.

<author name="e107 Inc" email="e107inc@something.com" url="https//e107.org" />

The following attributes of the author are defined here:

Summary

A text that shortly summarises the theme.

<summary>Bootstrap3 e107 theme</summary>

TODO: Check if using LAN is possible

Description

A text that provides a more elaborate description of the theme.

<description>a simple bootstrap 3 template for the frontend</description>

TODO: Check if using LAN is possible.

Category

<category>generic</category>

The category that a theme belongs to. Possible values are:

  • Generic

  • Adult

  • Blog

  • Corporate

  • Gaming

  • News

Plugins

<plugins>
    ...
</plugins>

plugin

<plugins>
		<plugin name='featurebox' url='core' />
</plugins>

TODO: check format for third-party plugins.

Keywords

<keywords>
		...
</keywords>

word

	<keywords>
		<word>bootstrap</word>
	</keywords>

Screenshots

	<screenshots>
		...
	</screenshots>

image

Refers to the location of the image file, relative to the root of the theme folder

	<screenshots>
		<image>preview_frontend.png</image>
	</screenshots>

Libraries

TODO: provide explanation

<libraries>
		<library name="bootstrap" version="3" scope="front,admin,wysiwyg"/>
		<library name="fontawesome" version="5"  scope="front,admin,wysiwyg"/>
		<library name="bootstrap.editable" scope="admin"/>
</libraries>

library

<libraries>
		<library name="fontawesome" version="5"  scope="front,admin,wysiwyg"/>
</libraries>

Stylesheets

	<stylesheets>
		...
	</stylesheets>

css

<css file="css/modern-light.css" name="Modern Light" description="A high-contrast light skin" thumbnail='images/admin_modern-light.webp' scope='admin' exclude='bootstrap'/>

TODO: asterix (*) usage?

Layouts

<layouts>
    ...
</layouts>

Each theme can contain various layouts. Additionally, each layout can be used for specific custom pages and each layout can have specific menu presets.

Layout

<layout name='modern_business_home' title='Modern Business: Home page carousel with fixed custom-menus' />

Custom Pages

<layouts>
		<layout name='jumbotron_home' title='Jumbotron (home)' default='false'>
			<custompages>FRONTPAGE</custompages>	
		</layout>
</layouts>

Using the e_ROUTE constant

Adding $CUSTOMPAGES to theme.php in e107 v2.x is deprecated and should be avoided!

Theme authors can create buttons for menus that can be activated by the user from "Menu Manager" or "Theme Manager". These are placed between and and should be enclosed in the and tags with the opening area tag naming the menu area it corresponds to; the example below would be for a layout with two (2) menu areas ({MENU=1} = and {MENU=2} = ). The tag "menu name" must contain the name of a valid and installed menu.

ThemePrefs

Set default theme preferences?

TODO: also refer to theme_config.php

pref

name, (value)

theme_config.php

This file can be used to add information and user-selectable options to the theme's configuration page.

Example

class theme_mytheme implements e_theme_config
{
    function process() // Save posted values from config() fields. 
    {
        $pref = e107::getConfig();
		
        $theme_pref 					  = array();
        $theme_pref['example']	= $_POST['_blank_example'];
        $theme_pref['example2']	= intval($_POST['_blank_example2']);

        $pref->set('sitetheme_pref', $theme_pref);
        return $pref->dataHasChanged();
    }

    function config()
    {
        $tp = e107::getParser();
		
        $var[0]['caption'] = "Sample configuration field";
        $var[0]['html']    = $tp->text('_blank_example', e107::getThemePref('example', 'default'));

        $var[1]['caption'] = "Sample configuration field";
        $var[1]['html']    = $tp->text('_blank_example2', e107::getThemePref('example2', 'default'));
		
        return $var;
    }

    function help()
    {
        return "
                <div class='well'>
                        Some information about my theme. 
                </div>
        ";
    }
}

Favicon

Automatically, e107 is looking for the favicon.ico file in the following locatons in this specific order:

  1. inside the root of the theme folder (e107_themes/yourtheme)

  2. inside the root of the e107 installation (/)

This way, theme authors can override the default favicon, and users can upload their own favicon to the theme folder.

Last updated