Google translator »

(Opens in a new window - öffnet in einem neuen Fenster)

Short Documentation Addon "TemplateFuncs"

About TemplateFuncs

TemplateFuncs is an Addon for CMSimple Templates. TemplateFuncs provides several useful functions for CMSimple templates.

1. System Requirements

TemplateFuncs requires a working installation of CMSimple_XH 1.2 utf-8 or higher.

Recommended is CMSimple 4.0 or higher.

2. Installation

  1. Download the zip-file and unzip it with a suitable program.
  2. Upload the folder "templatefuncs" to the folder of the template.

Now the file "templatefuncs.php" has to be included in the template.htm (on top, above the Doctype Declaration):

<?php include_once($pth['folder']['template'] . 'templatefuncs/templatefuncs.php');?>
<!DOCTYPE html>

3. The functions

3.1. The function "changing Newsboxes"

The newsbox function shows consecutively numbered CMSimple pages in a newsbox. The variantly shown CMSimple pages should begin with the name (normally "News"); followed by consecutive numbering. Example:

You can create consecutively numbered newsbox-pages as many you want. Later in this document I refer to News1001 - News1003. The large numbers are chosen, to avoid conflicts with existing newsboxes on the page.

The change of NewsBoxes will happen with every page view, regardless of whether a new page is called or by reload the current page.

Usage in template.htm

News boxes usually are called in the template (template.htm); inserted where the news box shall appear.

Ordered change

The following function-call shows the pages News1001 - News1003 successive:

<?php echo tf_newsboxes('News',1001,1003); ?>

Random change

The following function-call shows the pages News1001 - News1003, changing in random order:

<?php echo tf_newsboxes('News',1001,1003,'random'); ?>

3.2. The function "changing images"

This function allows changing images or background images via inline CSS in the template.htm. The image change will happen with every page view, regardless of whether a new page is called, or the current page is reloaded.

The images are located in a subfolder of the folder "templatefuncs", for example "templatefuncs/bgheader/" for changing background images in the header.

Simply upload your image files into the folder "templatefuncs/bgheader/", and they will be included in the image change. If you want to remove an image, just delete it. The function "changing images" automatically recognizes the images in the folder.

The folder where the image files are located, must be specified in the function call:

<?php echo tf_images('bgheader'); ?>

Example for changing background images in the header:

<div id="header" style="background: #fff url(<?php echo tf_images('bgheader');?>) no-repeat;">

Random change

For random change, add the optional parameter "random" to the function call:

<?php echo tf_images('bgheader','random'); ?>

3.3. The functions for "special Links with Icons"

With these functions, you can show special CMSimple-links with small images (icons).

<?php echo tf_homelink('homelink.gif'); ?>
<?php echo tf_printlink('printlink.gif'); ?>
<?php echo tf_mailformlink('mailformlink.gif'); ?>
<?php echo tf_sitemaplink('sitemaplink.gif'); ?>
<?php echo tf_previouspage('prev.gif'); ?>
<?php echo tf_nextpage('next.gif'); ?>
<?php echo tf_top('top.gif'); ?>

The icons are located in the folder "templatefuncs/icons/". The file name and the filetype you have to specify in the function call (filenname.gif, filenname.png ...)

The icons you can style with the following CSS classes in the stylesheet.css of the template (e.g. spaces between the icons):

img.tf_homelink_icon {margin-right: 16px;}
img.tf_printlink_icon {margin-right: 16px;}
img.tf_mailformlink_icon {margin-right: 16px;}
img.tf_sitemaplink_icon {margin-right: 16px;}
img.tf_prev_icon {margin: 0 16px;}
img.tf_next_icon {margin: 0 16px;}
img.tf_top_icon {margin: 0 16px;}

3.4. The Functions tf_prevpageTitle() und tf_nextpageTitle()

This functions are working like the original functions of CMSimple, but are using the title of the previous or next page instead of the variables from the language file.

With the parameters 'before' und 'after' you can insert characters before and after the title:

<?php echo tf_prevpageTitle('before','after'); ?>
<?php echo tf_nextpageTitle('before','after'); ?>

With empty parameters only the title will be displayed:

<?php echo tf_prevpageTitle('',''); ?>
<?php echo tf_nextpageTitle('',''); ?>

The simple function call without parameters will use "«" und "»":

<?php echo tf_prevpageTitle(); ?>
<?php echo tf_nextpageTitle(); ?>

3.5. The function openMenu()

With this function, you can create an opened menu. You optionally can specify two parameters, for menulevel "min, max":

<?php echo openMenu(1,2); ?>

Normally a simple function call is enough, menulevels as specified in the Configuration:

<?php echo openMenu(); ?>