Jump to content

Creating custom Staff Directory layouts

It is possible to create custom layouts for the Staff Directory page. You will need to write the templates using HTML, so to do this you will need to be familiar with HTML, as well as basic PHP logic.

In the AdminCP, go to Customization -> Themes and click the "Edit HTML and CSS" button for your default theme. Then, from the "New" dropdown, choose "HTML Template". You can name the template whatever you like, and fill the rest of the form out with the following details:

Variables: $users
Location: Add to an existing location
Existing Location: front
Group: Add to an existing group
Existing Group: staffdirectory
Application: System


You will then need to navigate to your newly created template within the many on the left (it will be under core -> front -> staffdirectory) and here is where you write the HTML code for your template. The template will be passed a $users variable which is an array of \IPS\core\StaffDirectory\User objects. Your code can include template logic and template tags You can use one of the existing templates as an example.

After this you will also need to create another template with the same name (and settings above) but with "_preview" appended to the name (for example, if the template you just created is called "myCustomLayout" the template you create now will be "myCustomLayout_preview") which contains the HTML to display on the form when creating a Staff Directory group in the AdminCP. Since you know what the layout will look like, you can make this quite simple.

You will need to repeat these steps for every theme you have installed (except child themes which will inherit the templates of their parents).

Once this is done, when creating a Staff Directory group, you will see the template you have created as one of the available options.

  Report Guide

  • Create New...