Contents
- Index
Layout, Customising
Jomres uses the patTemplate library almost exclusively for constructing output (there are exceptions, such as the availability/dashboard calendars and the tabbed options). The reason for this is simple. It is much easier for you as the system admin to modify the look and feel of your site when using templates than when html is embedded in code. Because the template code is used to make it easier for you to edit the look of your site I have refrained from using any of the patTemplate functionality beyond what is used to render html output, so you should find it very easy to edit the code to suit your requirements, however there are a few things you need to know.
The core template files are saved in the folder /components/com_jomres/templates/jomres/, however I want to discourage you from editing these files. If you upgrade Jomres you will lose all of your changes to these files, therefore it's better that you install a template override and edit these files instead. The basic template override is available through the Plugin Manager.
The template overrides hold the same files as those which can be found in the components/com_jomres/templates/jomres/frontend folder, however they are installed as a mini-component so they are saved outside of the standard Jomres folders. This means that when you upgrade Jomres you don't loose your edited files, and everybody wants to edit these files.
I will assume at this stage that you've taken the hint and installed the template override pack. When this is installed you will find the override files in the /components/com_jomcompbasictemplates folder. As the CMS component installer installed these files you may have problems with file permissions, (see Choosing your hosting for more on this subject) depending on your server configuration, so you might end up having to use Joomla Explorer to edit these files, if you can't via ftp.
Template files are called, as needed, depending on the screen you're viewing. Sometimes this is just one template, for example when you're viewing a list of properties (list_properties.html). Other times it can be many templates, for example the view property page can have up to 5 if slideshows and tariffs are shown inline. (property_header, property_details, slideshow.html ,show_tariffs.html & show_rooms.html. Also, it depends on your property configuration. If your property is an SRP (single room property) then instead of the rooms list you'll see the availability calendar.
Ok, onto a few questions I get asked from time to time:
In these template files there's stuff between curly braces ( {XXX} ). What are they?
The script passes the stuff within the curly braces to the template; it's the data that's generated by the system. Most of the time it's only shown the once, but sometimes we need to cycle through a list of data, in which case you'll often see code that looks like this:
<patTemplate:tmpl name="room_headers">
<table id="panelwrapper">
<tr>
<td>
<table class="innerwrapper">
<tr class="roomslist_header">
<td>{HEADER_IMAGEHEADER}</td>
<td>{HEADER_ROOMNUMBER}</td>
...
</tr>
<patTemplate:tmpl name="room_details">
<tr class="roomslist_content">
<td><img src=... nd();"></td>
<td>{ROOMNUMBER}</td>
...
</tr>
</patTemplate:tmpl>
</table>
</td>
</tr>
</table>
</patTemplate:tmpl>
(Edited to make it more readable)
In this example, there are two sets of rows; one is within the room_headers patTemplate declaration, whereas the other is inside the room_details declaration. The room_details data will be output by patTemplate for as many rooms as there are to display.
Don't worry if you don't understand it all immediately, you'll soon get it when you start experimenting with editing the files.
What can I edit in a template file?
This is a regular question I get asked, and the answer depends on which template you're editing.
If it's the booking form template, then the answer is: not much. You can move things around and hide them inside "divs" that have the same foreground and background colours but it isn't recommended that you actually remove anything. Probably the only exception to this rule would be the address input fields; if you've made a field so that it is not required during the booking process then you can convert this to a hidden field in the booking form. You can't remove the input completely because the booking object will still try to update that field if an authorised user selects a guest's name from the Guest Names drop down box, and if the input doesn't exist the JavaScript in the booking form will fail with an error. The smoking and guest numbers can be switched off by, respectively, switching the smoking option off in the property configuration and removing (or unpublishing) any guest types you have, but it's not recommended that you actually try to remove them from the form itself.
If it's any one of the other templates, then you're largely free to run amok with the delete key, but keep backups of the original files in case you go a bit wild and find you're unable to undo what you've done.
I want to show blah in x template. How do I do it?
The first rule to understand when editing templates is, if the data isn't available to the template then you can't show it, however there may be times when the template file you're using has data available to it but it's just not showing it. How do you find out?
The easiest way is to go to the Site Configuration and set "Dump Template Vars" to "Yes". This will use patTemplates built in dump feature. You can then analyse this dumped data to see if the required output is available to your template file.
What about if it's not there?
Then you're going to need to get your hands dirty by digging into PHP, which is beyond the scope of this guide.
Can I have different templates for multi-room and single room properties?
Yes, you can. Jomres provides for, but doesn't supply in a basic installation, the option to have different templates depending on this criteria. There are trigger points supplied which will allow you to call a different template depending on whether it's an SRP or an MRP.