Loading...
 

Webinterface Templates

Webinterface Templates


One intention to use PHP rather than the native C cgis was to enable users of perfparse to create custom templates. Almost all you need is HTML knowledge or a HTML editor. We use the smartyQuestion template engine to feed the HTML to the php processor. Below are some Instructions:



Create a new set of templates


On default Installations (compile prefix of perfparse is /usr/local/nagios) the default templates are located at

/usr/local/nagios/share/phpui/templates

You should first create a directory that holds your new templates:

cd /usr/local/nagios/share/phpui/templates
mkdir mytemplates

This directory name is your "theme". Then copy all default templates to your new theme:

cp *.html mytemplates

Edit your new set of templates


Now you can cd to this directory and edit the files (Example):

cd mytemplates
vi mainmenu.tpl.html

You will notice that there are some special tags in the html files. These tags start with {something} and sometimes have a ending tag {/something}.
For the unexperienced user: Just leave them alone!
For the experienced user i will list some of the mostly used tags here - all other can be fond on the smartyQuestion website.
Due to the special tags the page will not look the same in a html editor as later when delivered by php.

Special Tags


Translate the string:

 Plugin disabled

Plugin tr cannot be executed.
something {/tr}


Output the content of a variable:
{$var}

Loop through a array:
{foreach from=$array key=keyvar item=itemvar}
...
{/foreach}

Conditional:
{if condition}
...
{/if}

Activate the new set of templates


In your perfparse.cfg set the option:

PHP_Style=mytemplates

this should match the created directory above.

Share your new set of templates


Even if you think it is not nice, many people will probably like your new design. Give something back to free software! Post it as a patch at sourceforge, send me a mail with a zip file or whatever. You'll find a way :-)

Contributors to this page: redflo .
Page last modified on Wednesday 23 of January, 2008 22:38:53 UTC by redflo.

Shoutbox

redflo, 14:25 UTC, Sun 10 of Apr, 2005: No, lneuxyuhje, this shall write to a pipe not to a file and so ">" is o.k.
lneuxyuhje, 15:14 UTC, Thu 07 of Apr, 2005: is ">" meant to be ">>" in /usr/local/perfparse/bin/perfparse_nagios_pipe_command.pl ?
redflo, 08:35 UTC, Tue 05 of Apr, 2005: fhdplbvjipsld, it works now. Permissions were wrong.
fhdplbvjipsld, 14:42 UTC, Wed 30 of Mar, 2005: How to post to Forums->Help?
benclewett, 09:27 UTC, Thu 03 of Feb, 2005: Hi Jon! I hope you like our wiki site.