Changes Saved.
Error Occurred!


Adding Custom Pages to the Public Side of Our Products

You can create an entire web site by using only our products. Our products are written in a way that allows our clients to create custom web pages, which expand the functionality of the application by adding features.

So far, this feature is limited to the public side only. In order to successfully add a custom page, you will have to add two (2) files for every action (page):
1. PHP file that goes to /custom/CustomActionName.php
2. Smarty template file that goes to /templates/CustomActionName.tpl.htm

If either of those two files are missing, our product will ignore your custom page. The only thing you have to do in this instance is copy those files in the appropriate folders in order to access them.

PHP File

Your PHP file will be included if none of the default actions is found. Every page is specified as a different "action" in the system, and the page name corresponds to it's action. For example, in SupportTrio, if you go to a page:
you will open a ticket_submit page which is a valid SupportTrio action.

If you also wish to add, let's say, "contact_us" custom page/action since it is not a part of default SupportTrio distribution, you will have to add a file /custom/contact_us.php which you can use to execute whatever PHP code you need in order to produce that page (fetch emails of SupportDepartmants, etc...).

Your PHP file MUST look similar to this:

// your code for preparing this custom page variables goes here
// your code for assigning all needed variables into smarty template goes here


You will have to rememeber that there cannot be any output (using the echo, print, print_r, etc functions) in this file. Opening/Closing PHP tags can only appear at the very top/bottom of the script. If you wish to display some variable or some text, you will have to assign it to a Smarty template using the following command:
$customVar = 'custom value';
$smarty->assign('myCustomVariable', $customVar);

You can use some of the predefined variables that our software uses:
1. $user - an array with user information if he is logged in, false if not
2. $site - an array with all general settings switches
3. $langSet - string that holds current language name
4. $languages - an array of all installed languages
You can also call our debugging function dbg($var) to print out a content of a $var variable and to stop the script execution.

Smarty Template File

The best way to start using Smarty templates is to read the Smarty User Manual first. There, you will see how easy is to use Smarty. The most important thing to remember is to call all assigned variables as {$myCustomVariable}.

Your Smarty template should look like this (referring to the example assignment code):

<h1>My Custom Page</h1>
<p>The custom generated value is: {$myCustomVariable}</p>
<!-- rest of the HTML code here -->

And that's it, you have your custom page integrated into our product. Remember: enough integrated custom pages can create an entire web site wrapped around our product!

Related Articles