Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
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:
- Create folders for your template in
- Create a master template file
- 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:
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.
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.
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
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
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!