A2Billing template selection

This post follows on from a previous one about a Twitter Bootstrap template for A2Billing – http://sysadminman.net/blog/2012/a2billing-template-using-twitter-bootstrap-4557

It’s not immediately obvious how to select a different template in A2Billing. It only comes with a single template called ‘default’

To create another template you just create a new folder at the same level as ‘default’ and put your files in it. So, depending on your folder structure, you would end up with something like this for the customer interface and a template called ‘bootstrap’ –

/var/www/a2billing/customer/templates/default
/var/www/a2billing/customer/templates/bootstrap

To dynamically select that template you can pass a variable in the URL. The variable is called ‘cssname’ so the new URL would look something like this – https://livedemo.sysadminman.net/?cssname=bootstrap

Once the website visitor uses the site by passing the cssname this selection is stored in a session variable, meaning when they visit again they will get this template. To switch back you can just pass the ‘default’ template name – https://livedemo.sysadminman.net/?cssname=default

The only 2 ways I’m aware of setting this option as the default would be to either replace the default template, or change the line that sets it in the code. This is in –

./a2billing/common/lib/customer.defines.php

and is set here –

$_SESSION["stylefile"]='default';

1 thought on “A2Billing template selection

  1. Ulises

    Matt, thanks for posting this valuable information. Just let me add one detail for other readers.
    The selection of the template is working as you suggest (at least up to version 2.0.1), but there were a couple of bugs:
    – When logging off, it was displaying the default template.
    – In case there was an error, for example an session expired, the error screen was showing the default template.
    These bugs were fixed on the latest available source code at github star2billing project (https://github.com/Star2Billing/a2billing/commit/931a3b6cf43478f42a1ffa6c54c7eb280d945a54). Hopefully the next A2Billing release will contain these fixes.

Comments are closed.