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.

$disp meaning

Here are the possible values for $disp:

  • arcdir : archives directory
  • catdir : category directory
  • comments : latest comments
  • feedback-popup : this template displays the comments in case they are displayed in a popup
  • mediaidx: media files index
  • msgform : form to send a message
  • page : displays an Item of type "page"
  • posts : displays the Items/Posts of a blog, filtered or not with additional params
  • profile : form to edit user profile
  • single : displays an Item of type "post" (or other custom type)
  • subs : form to manage subscriptions

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.

evoSkin Structure

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 display, 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.

evoSkin Structure

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 directory will be used (in this case, /skins/_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 directory will be used (here /skins/_html_header.inc.php) would be used.

Last edit by on April 9th, 2015

No feedback yet