File theme.php

Information you can find in theme.php
on Monday 20 April 2020
comments: 0
Updated for version 2.3.0


You don't need to use those constants if you use libraries in theme.xml

define("BOOTSTRAP", 3);

define("FONTAWESOME", 4);

should be replaced in theme.xml file by:

bootstrap 3:

<libraries> <library name="bootstrap" scope="all"/> <library name="fontawesome" scope="all"/> </libraries>

bootstrap 4:

<libraries><library name="bootstrap" version="4" scope="all"/><library name="fontawesome" version="5" scope="all"/></libraries>

define('BODYTAG', '<body class="body-class '.THEME_LAYOUT.'">');

should by in theme.html replaced by

<body id="page-top" class="{LAYOUT_ID}" {BODY_ONLOAD} >


define('VIEWPORT', "width=device-width, initial-scale=1.0");

should be replaced in theme.php

e107::meta('viewport', 'width=device-width, initial-scale=1.0');

it is used for meta tag viewport in header_template.php (proper rendering and touch zooming if applicable)

No legacy stuff should be used in themes for version 2.2.2


There are still constants used in code from version 1 (I just let them there because default theme use them too):

define('OTHERNEWS_COLS',false); // no tables, only divs.

define('OTHERNEWS_LIMIT', 3); // Limit to 3.

define('OTHERNEWS2_COLS',false); // no tables, only divs.

define('OTHERNEWS2_LIMIT', 3); // Limit to 3.

define('COMMENTLINK', e107::getParser()->toGlyph('fa-comment'));


define('PRE_EXTENDEDSTRING', '<br />');

Update 2017/09: COMMENTLINK has default value in core, so no need to use it in theme.php, only if you want to have your own. Example of constants you can find in old themes:

Constant Description
define("STANDARDS_MODE", TRUE); Mainly IE ; correct boxmodel (legacy)
define("IMODE", "lite"); Icon-set use (eg forum dark/lite (legacy)
define("THEME_DISCLAIMER", "<br /><i>".LAN_THEME_1."</i>"); theme disclaimer (themeinfo)
define('WMFLAG', ''); Welcome message is not displayed at all, use {WMESSAGE=hide} now


load core libraries directly in theme.php is not needed anymore, theme.xml is enough

e107::library('load', 'bootstrap');

e107::library('load', 'fontawesome');

Where are core libraries files located?

You can find all information in Settings/Libraries.  

What paths are used depends if you use them locally or not.  


Note: from version 2.3.0 libraries should (could) be defined in theme.xml file, what is preferred way.  It doesn't mean you can't load them manually from the theme folder without libraries at all.

Load theme css and js files

For detailed information see Developer Manual Examples related to theming:

IE fix example:

e107::js('url','https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js','','2','<!--[if lt IE 9]>','');e107::js('url','https://oss.maxcdn.com/respond/1.4.2/respond.min.js','','2','','<![endif]-->');

Activate bootstrap tooltips :

e107::js("footer-inline", "$('.e-tip').tooltip({container: 'body'})");

Load scripts after JQuery:

e107::js("theme", "js/scripts.js", 'jquery');

Load translated strings


For Frontend your language strings should be a file with name English.php (or your language). For the Admin part, there should be an English_admin.php file (or your language). Both reside in the languages folder inside your theme.


Other links

Follow us