Server Side Includes

You can place static include files or executables in the ssi folder. The static files will be place right after the body or just before the end of the body.

This has nothing to do with the Apache module mod_include, it just implements Thruks way of SSIs.

Common Includes

There are global includes, which will be included in every cgi page:

  • ssi/common-footer.ssi

  • ssi/common-footer-*.ssi

  • ssi/common-header.ssi

  • ssi/common-header-*.ssi

Page Specific Includes

And there are page specific includes, which will only be placed in the specific page:

  • ssi/<page>-footer.ssi

  • ssi/<page>-footer-*.ssi

  • ssi/<page>-header.ssi

  • ssi/<page>-header-*.ssi

Replace <page> with the name of the page. You can find the page name in the url (see screenshot). Includes are only possible for the cgi pages, not for static html pages like the index.html.

ssi page

Static and Dynamic Includes

Files will be statically placed inside the output of the normal cgi output. Executables will be executed and the output will then be used as content.

Template Toolkit Syntax

new in release v2.34

Starting with Thruk 2.34 you can use template toolkit syntax in your ssi files.

Examples

To change the logo of the login page and add some help text, you could create a ssi file like this and store the company.png in your usercontent/images folder.

login-header.ssi:
<script language="javascript" type="text/javascript">
<!--
  var note = "<span style='color: #EE6E00; font-size: 25px;'>Test Server</span>";
  jQuery(document).ready(function() {
    jQuery("IMG.mainlogo")
      .attr('src', '../usercontent/images/company.png')
      .attr('width', '50%')
      .attr('height', '50%');
    jQuery("<br><b><div align='center'>"+note+"</div></b>").insertAfter("IMG.mainlogo");
  });
-->
</script>

Hide images in plugin output of extinfo page if user is not in Admins contact group:

extinfo-header.ssi:
[% IF !c.user_exists || !c.user.has_group("Admins") %]
<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery("TD.detail_plugin_output IMG").hide().after("<div>Image removed</div>");
});
</script>
[% END %]

Show alert box on all pages:

common-header.ssi:
<div class="alert floating" style="position: absolute; left: 0; right: 0; margin-left: auto; margin-right: auto; z-index: 100; top: 7px; width: 600px; text-align: center;">
  This alert will be visible on pages.
</div>
Edit page on GitHub