Chapter 4. Advanced usage

Domus Organizer provides a number of advanced features, so you can customize the product to meet your needs.

Template system

[Important]Important

This feature is available only inside the professional version of Domus Organizer

Domus Organizer come with a set of fixed layouts, but, until now, if you wanted to customize your installation you had to rely on template overrides (because you are using template overrides, right? You are not hacking core files, right?)

Template overrides are great, but they are not very user friendly.

First of all they require a little of FTP knowledge: you have to connect to your server, copy the file in your current template folder dedicated to the overrides and then start modifying it.

Then you have to know what you are doing, which means that you have to know a little of PHP, too. While editing, you have to care extra attention on not touching any PHP statements, since you could create a fatal error and get a white page.

But you just want to edit the HTML output, nothing else, there isn't a better way of doing this?

Yes, there is!

We created a template system, where you can create your HTML template, add the tokens you are interested in, and leave Domus Organizer do the rest.

And you can do all these things inside Joomla administration backend, using your favorite HTML editor.

Template management

A template is a piece of HTML code that you can craft on your needs.

Let's say that your site has a template that is using Bootstrap version 3 instead of the version 2, or you want to deeply change the structure of the property list.

For example, you want a different structure for hot properties (less details, more emphasis on the price or on the property details) rather than normal properties. Using our template system, you can create a different layout for Properties or Agents, for properties that belongs to a specific category or type; moreover, you can create a different template for a specific language, or you can simply use a single template for everything.

Domus Organizer has a clever way to detect the best template to use while displaying the page: first of all it will check if a template for the current view name and type exists, for example Properties Browse.

Then it will search the templates with the current language or, if not found, the templates with the language set to All. Finally, a search vs the category or the type is performed, if not found the most generic template is used.

This means that you can have a template for all the properties, but for a specific combination (for example Residential properties on sale) you can create a complete different one.

Figure 4.1. Template edit page

Template edit page

Title

The title of the template, we strongly suggest to use a mnemonic title.

Published

Is this template published?

Language

To which language this templates applies to? This is very useful for multilanguage sites: you can replace static text with the correct translation or hide any details that are not important for foreign customers.

Please refer to the Multi language support section to translate all the dynamic parts inside Domus Organizer, such as the property description, the category or the type title and so on.

Key

The generated key used for calculating the best template to use

View name

The view related to this template, for example Properties, Agents or Agencies

View type

The view type, for example Browse (for lists) or Single Item

Type

Property type assigned to the template This option is available only when the View name is set to Properties

Category

Property category assigned to the template This option is available only when the View name is set to Properties

Only hot

Is this template assigned to hot property only? This option is available only when the View name is set to Properties

You can find the full list of available tokens here or inside Domus Organizer template edit page.

[Important]Multi language and templates

If you are going to create a multilanguage site, please remember that you have to create a template for each language, manually translating the static text (such as Category or Type).

This is a small price to pay in exchange to the full flexibility offered by the template system.

[Note]View type and template scope

The Single Item view type deals, obviously, view a single item, meanwhile the Browse one deals with a single item of the list.

This means that the Browse template will be loaded several times, one for every record. In this way you can create fancy layouts, for example 3 tiles for every row.

[Note]Tokens and HTML special chars

When you add a token, please double check that there isn't any unwanted hidden HTML chars inside the token syntax, otherwise Domus Organizer won't recognize the token and the substitution is not performed.

Advanced template usage

Creating a new template is just the starting point, you can achieve very beautiful results with a little of effort and some useful tricks.

Adding property fields

Inside your template you can reference property fields, too.

A new token will be created for each group and element, following this logic:

PROP_GRELEMENTS_<group name>

Token for the group. The group name will be transformed in uppercase converting all the spaces in underscores. For example, the token for the group Property details will be PROP_GRELEMENTS_PROPERTY_DETAILS

PROP_ELEMENTS_<element name>_LBL

Token for the element label. The element name will be transformed in uppercase converting all the spaces in underscores. For example, the token for the group Stable condition will be PROP_ELEMENTS_STABLE_CONDITION_LBL

PROP_ELEMENTS_<element name>_VAL

Token for the element value. The element name will be transformed in uppercase converting all the spaces in underscores. For example, the token for the group Stable condition will be PROP_ELEMENTS_STABLE_CONDITION_VAL

[Note]Shorthand tokens

If you don't want to enumerate all the property tokens, there are two ready to use template tokens for property elements:

PROP_ELEMENTS_SLIDERS

Will create the full list of elements grouped by element group. Each group will create a new slider

PROP_ELEMENTS_PLAIN

Will create the full list of elements grouped by element group. Each group will create a new fieldset

Adding a default value for the token

Sometimes you want to display a default text if the token hasn't any value. For example, in the agent view, if the agent has no mobile number, you want to display the agency phone number.

You can easily achieve that, using the following syntax: [AGENT_MOBILE:555-123456]

You can embed HTML code, too: [AGENT_MOBILE:<strong>Not Available</strong>]

[Note]Templates and page formats

Templates are available for standard HTML pages only (the one you can see with your browser), they are not supported in the print or PDF format, since they usually require several "hacks" in order to create a proper layout display.

In such cases you can still rely on good old template overrides.

Refer one or more property fields from another one

Let's say you want to create a single field containing the data coming from several different other fields. For example you have the heating details split into several different fields, but you want to display them all in a single field.

First of all you have to double check that the plugin Content - Domus Organizer Token replacer is installed and enabled. Then create a new property field. Inside the property details, set use the available tokens to merge the other fields. For example

[PROP_ELEMENTS_HEATING_SUPPLY_VAL] [PROP_ELEMENTS_HEATING_VAL] Powered by [PROP_ELEMENTS_HEATING_POWER_VAL]

This will produce as output:

Figure 4.2. Administrative view

Administrative view

Figure 4.3. Public view

Public view

As you can see the whole list of properties has been replaced with the correct values.

Templates for e-mails

If you want to email automatic search results to your users, you have to create two different templates, one for customers and another one for property owners.

Inside each one you can use all the available tokens, you only have to remember to create an HTML element with the ID emailProperty in the customer email and another one with ID emailCustomer in the owner email.

While preparing the email, Domus Organizer will use those elements as "starting point" for each result. Let's say you have 5 properties: Domus Organizer will fetch the structure of the HTML element with the id emailProperty and then fill the details of each property, building up a nice list.