Portal Administration Guide : Customize Xinet Portal : Customized Tags

Customized Tags
Xinet Portal comes with an extensive list of existing tags for use in customizing the Xinet Portal templates. (See Appendix: Xinet Portal Tags and Templates.) Sometimes it may be necessary, however, to enhance an end-users experience by introducing new data or action buttons not present in the default tags. This section discuss adding Variable Data Tags in both the base Xinet Portal template page and an array of files.
Adding a General Page tag
Dynamic and/or static data of all kinds may added to the body area of a Xinet Portal template. This is done by adding a simple script to the local.inc.php file found with the templates of a Xinet Portal Web site. In this example we will add the user’s name and date to a tag as a welcome banner. Once this script is added to the local.inc.php file, it can be used in any of the templates associated with the current Xinet Portal Web site. To add the functionality to another Xinet Portal Web site, simply copy the script to another Xinet Portal Web site’s local.inc.php file.
Example: Creating a welcome Banner
Goal: To display a welcome banner for each user.
Customization method: Create a new string, $banner, inside the local.inc. php file, build a new Variable Data Tag, and use it in the toplevel.tmpl.html file.
For use with:Exhibit-style sites.
To create a script that will display a welcome banner we will use Xinet Portal data to provide the user’s name and the PHP date() function to generate the current date. Refer to the PHP manual (http://www.php.net/manual/) for the use of date().
/* */
/* Create $banner string to include user name and current date */
/* */
$banner = "Welcome " . $tmpl->USERINFO['USER'] . ", the current date is " . date("F j, Y");
/* */
/* Assign $banner strings to the Variable Data Tag */
/* named "BANNER" Note: the Variable Data Tag MUST be in all UPPER CASE letters */
/* */
$tmpl->add_var("portalpage", "BANNER", $banner);
The string assignment in this example creates the variable $banner. Then $banner is given the static text values of Welcome and , the current date is. Dynamic data, the user’s name, is assigned calling the variable $tmpl->USERINFO['USER']. The current date is also dynamically generated by using the PHP function date() and formatting the date as month F, day j and year Y:
$banner = "Welcome " . $tmpl->USERNAME['USER'] . ", the current date is" . date("F j, Y");
With the string $banner now assigned we can call the Xinet Portal function to build our new Variable Data Tag. This is done by calling:
Usage of $tmpl->add_var():
"VARIABLE_DATA_TAG_NAME", "Variable_Data_Tag_Value"
WNPortal_Tag_Name is the name of the Xinet Portal tag that this Variable Data Tag will be assigned, e.g., portalpage.
VARIABLE_DATA_TAG_NAME is the name to assign a Variable Data Tag used in a Xinet Portal template, e.g., PATH. (Please note that all letters must be uppercase!)
Variable_Data_Tag_Value is a string defined in quotes or an assigned variable or a call to another function, e.g., a string such as Hello World, a variable such as $somevariable, or a function such as do_somefunction( ).
So, in our example, we add the following:
$tmpl->add_var("portalpage", "BANNER", $banner);
Let’s now replace the {LANG_VOLHEAD} and {UN} tags with the new Variable Data Tag {BANNER} in the toplevel.tmpl.html template in an Exhibit-style site.
Example: Replace Top Level with Home in Path Bar (Changing Existing Tags)
Goal: In this example, we will replace the word Top Level with the word Home in the path bar for a Exhibit-style site.
Customization method: Add a script within the local.inc.php file, then edit templates which contain a path bar.
For use with: Exhibit-style site.
To change the path name:
Open the Site_Directory/templates/local.inc.php file with a text editor.
$home_path = preg_replace ('/Top Level/', 'Home',
$tmpl->add_var("portalpage", "HOME_PATH", $home_path);
In the info_toolbar.tmpl.html, toolbar.tmpl.html, and filemanger_navigator.tmpl.html templates replace {PATH} with {HOME_PATH}. Also insert <div style="display:none">{PATH}</div> as the second line in each file.