Skip to content
Sebastian Grewe edited this page Apr 16, 2014 · 5 revisions

Overview

When I started developing MPOS I wanted to make sure that pool operators have complete freedom over the template used on the front end. I could say this was the main reason, but to be honest: I am really bad with web design. Since I am unable to work on projects that combine PHP and HTML code, I used an old framework of mine that is using Smarty Templates. It turned out to work really well when migrating the old mmcfe theme over, I decided to stick with it.

File based templates

Creating your own template, or just copying the original one and customise it, is pretty straight forward:

  1. Create folders for your template in site_assets and templates
  2. Create a master template file
  3. Create templates for all pages (or start with imported default files)

You can always use the existing template as a reference. If you don't want to use certain data on them, just leave it out from the tpl version you are creating.

I highly recommend turning on PHP errors to the browser. This will allow for easier error spotting than having to check a logfile! If you still want to use the logfile method, use tail - f which will let you view updates to the file without having to reopen.

#Basics To create a file based template its recommended to use a premade template of some kind and split the code into various sections including:

  • Navbar
  • Breadcrumb
  • Header
  • Footer
  • Alert
  • Main

Getting Started

To create a theme file first run mkdir public/templates/ and mkdir public/site_assets/ To proceed from here copy all the files from the MPOS theme folders into the new theme folder and copy all css, js and img files into the appropriate dir under site_assets. Edit the master.tpl in the public/templates/ and begin to create or paste the code for the main layout including setting the names for all the areas as done already in the mpos theme files.

Globals

When creating the globals it is essential for them to be global as they will be used on every page as an exact copy. This includes the header, footer, nav bars, breadcrumbs and other files. It is essential that all possible content is escaped to reduce the likelihood of XSS attacks.

Individual pages

It is now time to add the theme and make any required modifications to each page in order to make it fit the whole site

Finish

You can visit the site and switch to the new theme using the theme dropdown in the admin settings panel. To view any errors it is recommended to enable PHP errors or view the apache2 or nginx error logs

Summary

As you can see, it's pretty easy to start your own look and feel. If you have created a theme from scratch, please let me know so I can add it to a list of pools running their own customizations!