evoSkin Structure
evoSkins are basically collections of template files inside of a skin folder.
This is the organization of templates inside a skin folder.
What template is called by b2evolution?
b2evolution chooses which template to display based on the "payload" requested by the user/web browser through the URL of the current page. Internally, the "payload" type is identified by the variable $disp
(which you can regard as meaning "display" or "dispatch", whichever makes more sense to you).
In some situations you can also see URLs containing a param string like ?disp=users
. In this case we specifically request the "users" template. In other cases, the $disp
is inferred by the URL; this is notably the case with permalinks for posts which resolve to $disp='single'
by default.
Learn more: Disp Reference.
$disp meaning
Here are possible values for $disp
:
- disp = arcdir : archives directory
- disp = catdir : category directory
- disp = comments : latest comments
- disp = mediaidx: media files index
- disp = msgform : form to send a message
- disp=page : displays an Item of type "page"
- disp = posts (List of Posts / Items) : displays the Items/Posts of a collection, filtered or not with additional params
- disp = single : displays an Item of type "post" (or other custom type)
- See more in: Disp Reference.
Main templates
At the very least, a skin folder like /skins/myskin2
must contain a main template file named index.main.php
.
Depending on what b2evo wants to display, it will call a specific "top level" a.k.a. "main" template (*.main.php
) within the skin folder. If the sought template is not found, b2evo will fall back to the default index.main.php
.
Fallback to the main template
As previously said, if the sought template is not found, b2evo will fall back to the default index.main.php
template. Thus, the main template is really the only mandatory template for a simple skin.
Many skins only have one main template.
Disp templates
If no main template has been found for a specific $disp
, the default index.main.php
will be called. That template will generally include a call to skin_include( ‘$disp$’, … ) which will in turn include a "level 2" a.k.a. "disp" template.
Fallback to factory templates
If a specific disp template is not found within the skin directory (for example, if /skins/myskin2/_msgform.disp.php
is not found), then the default disp template from the /skins/fallback_v*
directory will be used (in this case, /skins/fallback_v6/_msgform.disp.php
would be used).
Include files
The main and disp templates above may in turn call include files (*.inc.php
).
For example, many skins will use a common header and footer for all their templates. These should be in include files named like this:
_html_header.inc.php
(contains INvisible common headers, typically the<head>
section of the HTML pages)_body_header.inc.php
(contains VISIBLE common headers, typically the top blog banner)_body_footer.inc.php
(contains VISIBLE common footers, typically the bottom credits)_html_footer.inc.php
(contains INvisible common footers, typically logging and debugging code)
Fallback to factory includes
If a specific include file is not found within the skin directory (for example /skins/myskin2/_html_header.inc.php
is not found), then the default include from the /skins/fallback_v*
directory will be used (here /skins/fallback_v6/_html_header.inc.php
) would be used.