MyBB Community Forums

Full Version: Creating Templates, Tutorial?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just wondered how to do a own template for Mybb...
I took a look in the wiki, but this tutorials seems a bit...don't know...short?
Is there really everything covered what i need for making a template?
If no, is there another Tutorial?

And just some general templating question:
The Category and Posts Blocks are generated with a table, or not?
And how is the dynamic size of rows and pages done? How can you tell the Board that a special graphic should be repeated if the size of the page gets better?

Hope i don't annoy with this question but just found the one tut in the wiki, no Faq and nothing to special with the Forum Search.

Thank you in advance, Biber
You'll need to know HTML, CSS, PHP, and JavaScript for what you want to do. The template just uses JS & HTML. You can use CSS in the theme manager and php is the stuff that processes the templates and tells it how to repeat the row for a thread etc. JS can be used for the size of the page checking and html and css are used to style it and design it to your liking.
So it's not that easy by just creating tables and inserting some code and so on? So before i beginn i have really to know html, php, javascript and css?

And in most templates style is seperated from code , or not?
Is there somewhere a list of what file is used for what?
As is see i need to take some time and go on learning.
But just want to know what i need to to able to do a really simple template.
It's really difficult to explain in short. Basically each part of the page is made up of a template. If you view the source of this page, you'll see which templates are being used where. The templates are enclosed with <!-- start: templatename --> and <!-- end: templatename -->. How the actual information gets into the template to be outputted is with the PHP script. The PHP code generates whatever is needed and stores it in a variable (for example $x). In the template where the information the variable 'x' contains is to be displayed, there is a {$x}. So when the template is parsed, {$x} will be replaced with whatever $x contains.

Most of the time, you'll use the default templates as a base, and modify the template so that it looks the way that you want. The easiest way to do this (you need to know a bit of HTML) is to look through the source of the page, and find what you want to change. Then look for the <!-- start: templatename --> and <!-- end: templatename --> that enclose it, and edit the template there.

We've tried to separate the CSS from the templates. Most of the CSS is generated by the theme. All of the HTML is generated by the templates.

I hope that explains at least a bit of the templating system.

If you want to add something (like a table as you've said) you'll need to find where you want to put it, and add it into the template. This only applies to static data (stuff that does not change). If you want to make something like a table with the "top 10 highest reputation users" you will need to get some PHP to do the work as well as design the table in the template.