MyBB Documentation

Templates

The 1.6 Documentation is no longer maintained and some information may be outdated.

The MyBB 1.6 series reached end of life on October 1, 2015.

This means there will be no more security or maintenance releases for these series and forums running these versions of MyBB may be at risk of unfixed security issues. All administrators are strongly encouraged to upgrade their forums to the latest release of MyBB as soon as possible.

Templates & Style: Templates

Templates are all of the pieces that make up the layout of your board, using HTML. Templates are stored in the database.

The base page in the templates section displays all of your template sets. Each theme has a template set that it uses, however, multiple themes can use the same template set. Every template set contains all of the templates that make up your forum's layout.

Contents

Global Templates

Global templates are used by all themes, and usually are used for plugins and the like. They are helpful for templates that are needed in all themes.

Managing your templates

When you expand a template set, you are presented with a page listing all of the groups of templates within that template set. All templates have a group. Expanding a group shows the templates within that group, and can be done by choosing "Expand" under controls or by clicking on the template group's name.

Templates & Style: Template Set

Template Groups

There are many template groups in each template set. They are:

Calendar Templates 
The Calendar section
Edit Post Templates 
The edit post page.
Error Message Templates
All error messages that exist in MyBB.
Footer Templates 
Templates for the footer area of the forum layout, including footer links and copyright.
Forum Bit Templates
The forum name and description, post indicator, number of threads, latest post info, etc. seen on pages such as the index page.
Forum Display Templates
The forum display page, also known as the thread listing.
Forum Jump Templates 
The forum jump drop-down found on many of the pages in MyBB.
Global Templates 
Templates that apply to all pages.
Header Templates 
The header area of the forum layout, including logo, top links, and welcome block.
Index Page Templates 
The default index page (the main page).
Manage Group Templates 
The templates for the pages in the User CP allowing group leaders to manage their group.
Member List Templates 
The list of members of your forum.
Member Templates 
Member pages, such as the profile, login, register, activate, email user, and reset password pages.
Miscellaneous Templates 
Templates for the misc.php file, including help documents and the smilies listing.
Moderation Templates 
The inline and standard moderation templates used throughout the forum.
Moderator Control Panel Templates 
Templates for the Mod CP.
Multipage Pagination Templates 
The links used throughout to navigate through listings with more than one page of results.
Navigation Templates 
The navigation bar telling you where in the forum you are (for instance, "Your Forums / User Control Panel"). This is also the breadcrumb.
New Reply Templates 
The new reply page.
New Thread Templates 
The new thread page.
PHP Templates 
Templates for the PHP warnings.
Poll Templates 
Templates for polls on your forum.
Portal Templates 
The forum portal.
Post Bit Templates 
The templates for each individual post.
Post Templates 
Attachments for the posting page that are available on all post pages, including attachments, CAPTCHA, drafts, and subscriptions.
Print Thread Templates 
The page allowing you to print threads.
Private Messaging Templates 
The private messaging portion of the User CP.
Redirect Templates 
The friendly redirect pages on your forum.
Report Templates 
The "Report This Post" feature.
Reputation Templates 
The reputation system.
Search Templates 
The search feature, allowing you to search for posts and threads.
Show Forum Team Templates 
Templates for the Forum Team page.
Show Thread Templates 
The show thread page, listing the various posts in each thread.
Smilie Inserter Templates 
The inserter for smilies on the post pages.
Statistics Templates 
The Forum Statistics page.
User Control Panel Templates 
The User Control Panel.
Warning System Templates 
Templates for the forum warning system.
Who's Online Templates 
The "Who's Online" pages, including the Who's Online Now and Who Was Online Today pages.
XMLHTTP Templates 
Templates for the AJAX features on your forum.
Ungroup Templates 
Other miscellaneous templates that do not need a group, as well as your own custom templates.
Templates & Style: Edit Template

Editing Templates

You can edit templates by clicking on their name in the listing or by selecting "Full Edit" in the Options drop-down. You can only use HTML in templates. PHP is not parsed in templates. The only PHP values accepted are scalar and hash values such as {$myvalue} or {$myvalue['myhash']} Also you may want to try out, "PHP in Templates and Template Conditionals", This plugin will allow you to use PHP in templates, as well as shortcut template conditionals and some shortcut string functions, https://community.mybb.com/thread-31860.html

The template editor uses Codepress to allow for line numbering, easy tabbing, and coloring of certain values, just like a normal HTML editor.

You can choose to either save and continue editing your template or save and return to the listing.

Templates & Style: Difference Report

Difference Report

After a template has been edited, you can choose to show a template difference analysis, which will compare your current template with the default template. You can access the difference report for an edited template by choosing "Diff Report" in the template's Options drop-down menu.

Reverting Templates

You can revert edited templates by selecting "Revert to Original" in the Options drop-down menu for that template. You can only revert templates that have already been edited.

Deleting Templates

You can only delete custom templates, and not those that are included with MyBB by default. You delete a template by choosing "Delete Template" from the template's Options drop-down menu.

Templates & Style: Add Template Set

Add Set

You can add a new template set based off of the default MyBB templates from the "Add Set" link. All that is required is a title for the template set. In order for the template set to be used, you must have a theme that has this template set selected.

Templates & Style: Add Template

Add Template

You can add a single template to any template set from the "Add Template" link. You must set a template name, the template set it should be located in, and the content for the template. You can then choose to save and continue editing the template or save and return to the listing for the template set you choose for this template.

Templates & Style: Search and Replace Templates

Search/Replace

You can either choose to search for a snippet of code (and optionally replace it with another snippet of code), or search for templates by the template title.

Be aware: There is NO confirmation before replacing code. Any templates found with the code snippet you enter will have that code replaced with the replacement snippet you entered.

Find Updated

From release to release, there are often changed templates. If a template has not been edited, it will automatically be updated to the latest template during the upgrade process. However, edited templates will have to be updated via the "Find Updated Templates" feature.

Your are provided a listing of all templates, from all template sets, that are different than the latest templates. You can choose to edit, revert, or perform a difference analysis for each of these templates.

Admin CP
Home Dashboard - Preferences - Version Check - MyBB Credits
Configuration Settings - Banning - Custom Profile Fields - Smilies - Word Filters - MyCode - Languages - Post Icons - Help Documents - Plugins - Attachment Types - Moderator Tools - Spiders/Bots - Calendars - Warning System - Thread Prefixes
Forums & Posts Forum Management - Forum Announcements - Moderation Queue - Attachments
Users & Groups Users - Groups - User Titles - Banning - Admin Permissions - Mass Mail - Group Promotions
Templates & Style Themes - Templates
Tools & Maintenance System Health - Cache Manager - Task Manager - Recount and Rebuild - PHP Info - Database Backups - Optimize Database - File Verification - Administrator Log - Moderator Log - User Email Log - System Mail Log - User Warning Log - Statistics
MyBB Customization
Templates/Themes Authoring - Template Management - Theme Management - User-created
Plugins Authoring - Plugin Hooks - Plugin Management - User-created
Translations Language Management - Download
Links MyBB Mods

Edit this page on GitHub