LunpaCMS Whipping your website into shape! Introducing Lunpa, our mascot.  Her mother was a hamster and her father was Chilean M00se.  Oddly, neither smelt of elderberries.


LunpaCMS Template Manager Documentation

A Quick Introduction

LunpaCMS generates webpages through the use of templates; and Template Manager organizes and edits those templates to make your vision of your website a reality.

Creating A New Template

  1. Click the "Add a New Template" link from Template Manager menu, and Add Template Form will show.
  2. Provide template name, contents, and all desired optional template attrinutes in the form. Template name muse be unique and self-and end with .template and template names are case-insensitive meaning you will not be able to add Template.template and template.template to the same site.
  3. Click the "Add Template" button.

NOTE: Template names are VERY important. They should be precise and self-describing, as they show in page URLs and in web page title in page headers. Abbreviated template names can cause confusion and lose search results. Use underscores for spaces.

Deciding Which Template To Edit

  1. Navigate in a web browser to the page you wish to edit.
  2. Look at the URL query string for the "template=<template_name>" portion. This is the name of the template you want to edit. Or if your website URL is in <site_domain>/template/<template_name>/... format, the string between 'template/' and next foreslash is the name of the template you want to edit.
  3. If there is no template parameter, you are likely on a main index page or a splash page! The index.cgim page usually use a template called index.template. Splash pages will be in either main.template or splash.template.

Template Listing

Template listing shows all templates available in the system including deleted templates. You can filter templates by their attrinutes such as on/off sitemap, locked status, admin only status, or by category. Template listing provides template edit, copy, delete, locked status change, and live view links for each template.

Editing Templates

There two ways to edit a templates: using Template Manager web interface and using lunpavi.pl from Linux prompt. All template attributes can be edited through web interface, but only template contents can be edited through lunpavi.pl.

Lunpavi also keeps track of the templates you have recently edited. To see which templates were edited last use ./lunpavi.pl show-recent

Copying A Template

  1. Find the template you wish to copy in the Template Manager listing.
  2. Click the "Copy" link to make a duplicate template.
  3. A duplicate template with "_copy" in its template name will be created. All template attributes will be copied also.

Deleting A Template

  1. Find the template you wish to delete in the Template Manager listing.
  2. Click the "Delete" link to delete it. You will be asked to confirm the deletion before it actually occurs.
  3. Confirming the deletion will refresh the Template Manager listing, and the template will be marked as deleted and moved to deleted templates section at the bottom of template listing. This template will not available to public.
  4. If you want to undelete a template, click "Undelete" link and it will be moved to template listing and be available to public.
  5. If you want to delete a template permanently, click "Delete Permanently" link and it will be deleted from system permanently. This action is not reversible.

Template Categories

  1. To create a new category, rename categories, or delete categories, click on "Template Categories" from Template Manager menu.
  2. Templates can be sorted by category.
  3. Uncategorized templates are always shown at the top.
  4. You can change a template's category at the same time as editing or renaming it.

Friendly URL

Template Manager enables the use of friendly URL for better SEO support. Friendly URL will be better understood by search engines. Default template page URL shows in the following format:

http://<site_domain>/base.cgim?template=<template_name>

However, if LOCAL_TEMPLATEMANAGER_USE_FRIENDLY_URL map is set to 1, the page URL will show as:

http://<site_domain>/template/<template_name>/

To enable friendly URL:

  1. Navigate to your document root directory.
  2. Open .htaccess file.
  3. Add following code to .htaccess and save changes:
    # FRIENDLY URL REDIRECT
    RewriteCond %{REQUEST_URI} ^\/template\/
    RewriteRule (.+)$ base.cgim [L]
  4. From Map Manager, add or update LOCAL_TEMPLATEMANAGER_USE_FRIENDLY_URL map to have value 1.

Template Specific Metadata

Template Manager allows users to enter meta title, description, and keywords for each template. If metadata is defined, LunpaCMS shows defined metadata in template header when the template page shows. If no metadata is defined, LunpaCMS will get it through auto meta feature.

Template Lock Feature

Template locking is used to prevent a template from being edited by multiple users at one time. When a user opens a template from web interface or lunpavi.sh, the template is locked and no other users can be able to open it for editing. Also, when a user tries to save a template, LunpaCMS checks if the template was opened by the user who tries to save it, and allows saving onyly when it is true. A template's lock status can be change by status change links in template listing any time. If the locked status of a template is changed on purpose by another administrator while being edited, the original person who opened it for editing cannot save changes. LunpaCMS shows an alert message for this conflict.

Templates within Templates

Templates can be called from within templates. You can thus have a template with templated subsections. These subsection templstes are called by using the LunpaCMS code of :::TEMPLATE:<template name>:::. This simply inserts the child-template into the parent-template at the location where the code is called.

For example:

ParentTemplate

This is a test<br>
:::TEMPLATE:ChildTemplate1:::
:::TEMPLATE:ChildTemplate2:::
This is a test

ChildTemplate1

ChildTemplate1 Test<br>

ChildTemplate2

ChildTemplate2 Test<br>

Will result in the following:

This is a test<br>
ChildTemplate1 Test<br>
ChildTemplate2 Test<br>
This is a test

Advanced Template Codes

Templates can also be called with arguments, such as :::TEMPLATE:TEST:ARGS: test1=test&test2=TEST :::. This is especially nice when you have a template that only needs a few minor tweaks when it is called. The arguments passed to the template are then called within the template by using :::template_args_<variable>:::. Using the earlier example, :::template_args_test1::: will output "test" and :::template_args_test2::: will output "TEST".

As a further example:

ParentTemplate

This is a test<br>
:::TEMPLATE:ChildTemplate:ARGS: color=blue&name=Jason :::
<br>
:::TEMPLATE:ChildTemplate:ARGS: color=red&name=Thomas :::
<br>
This is a test

ChildTemplate

If only :::template_args_name::: wore :::template_args_color::: shirts.

Will result in the following:

This is a test<br>
If only Jason wore blue shirts.
<br>
If only Thomas wore red shirts.
<br>
This is a test

LunpaCMS Codes

The following are a list of some LunpaCMS codes that are relevant to add to a template to get various functionality with the various LunpaCMS code

#VARIOUS HEADING AUTOMATION
:::HEADING:(.*):LEVEL:(.*)::: - This LunpaCMS code does the following.
:::HEADING:(.*)::: - This LunpaCMS code does the following.

#TEXT BOX AUTOMATION
:::TEXT_BOX_START:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::TEXT_BOX_END:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.

#LINKS
:::URL:(.*):ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::LASTURL::: - This LunpaCMS code does the following.

#RADIO BUTTONS, CHECKBOXES & SELECT BOXES
:::CHECKBOX:VARIABLE:(.+):DEFAULT:(.+)::: - This LunpaCMS code does the following.
:::RADIO:VARIABLE:(.+):VALUE:(.+):DEFAULT:(.+)::: - This LunpaCMS code does the following.
:::SELECT:VARIABLE:(.+):TAG:(.*):FUNCTION:(.+):ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::SELECT:VARIABLE:(.+):TAG:(.*):FUNCTION:(.+)::: - This LunpaCMS code does the following.
:::ENHANCED_SELECT:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::DATE_OF_BIRTH_SELECT:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::DATE_OF_BIRTH_SELECT::: - This LunpaCMS code does the following.

#VARIABLES FOR LINK AUTOMATION
:::CARRYOVERVARS::: - This LunpaCMS code does the following.
:::CARRYOVER(_VARS|VARS_FORM)::: - This LunpaCMS code does the following.
:::CARRYOVERVARS_FORM_LOGIN::: - This LunpaCMS code does the following.

#HTML TABLE BOX AUTOMATION
:::BOX_BOTTOM::: - This LunpaCMS code does the following.
:::BOX_TOP:TITLE:([^:]*):WIDTH:([^:]*):BODYPADDING:([^:]*)::: - This LunpaCMS code does the following.
:::BOX_TOP:WIDTH:([^:].*):TITLE:(.*):CELLPADDING:(\d*)::: - This LunpaCMS code does the following.

#TEMPLATE INFO
:::TIMESTAMP::: - This LunpaCMS code does the following.

#USERMANAGER
:::COOKIE_TEST::: - This LunpaCMS code does the following.
:::USERNAME::: - This LunpaCMS code does the following.
:::IS_LOGGED_IN::: - This LunpaCMS code does the following.

#TIME/DATE
:::(DATE|TODAY)::: - This LunpaCMS code does the following.
:::PRETTY_DATE::: - This LunpaCMS code does the following.
:::PRETTY_DATE:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::TIME::: - This LunpaCMS code does the following.
:::PRETTY_TIME::: - This LunpaCMS code does the following.
:::DATE:FORMAT:(.+)::: - This LunpaCMS code does the following.
:::CURRENT_YEAR::: - This LunpaCMS code does the following.

#ORDERMANAGER
:::ORDER_PRINT_ITEMS::: - This LunpaCMS code does the following.
:::ORDER_PRINT_RECEIPT::: - This LunpaCMS code does the following.
:::ORDER_BILLING_ADDRESS::: - This LunpaCMS code does the following.
:::ORDER_SHIPPING_ADDRESS::: - This LunpaCMS code does the following.
:::ORDER_CC_NUM::: - This LunpaCMS code does the following.
:::ORDER_CC_NUM_PRINT::: - This LunpaCMS code does the following.
:::STATUS_SELECT::: - This LunpaCMS code does the following.
:::STATUS_CHANGES::: - This LunpaCMS code does the following.
:::ORDER_DATE::: - This LunpaCMS code does the following.
:::ORDER_TIME::: - This LunpaCMS code does the following.

#ITEMMANAGER
:::ITEM_QUANTITY_CODE_SELECT::: - This LunpaCMS code does the following.
:::ITEM_PARENT_SELECT::: - This LunpaCMS code does the following.
:::ITEM_CATEGORY_SELECT::: - This LunpaCMS code does the following.
:::ITEM_TEMPLATE_MANAGEMENT::: - This LunpaCMS code does the following.
:::ADMIN_SHOW_ITEM_IMAGE::: - This LunpaCMS code does the following.
:::PRINT_IMAGE::: - This LunpaCMS code does the following.
:::PRINT_IMAGE:(.*)::: - This LunpaCMS code does the following.
:::FRONT_ITEM_LARGE:(.*)::: - This LunpaCMS code does the following.
:::GET_CATEGORIES::: - This LunpaCMS code does the following.

#SHOPPINGCART
:::CART_PRINT_ITEMS::: - This LunpaCMS code does the following.

#NEWSMANAGER HEADLINES
:::HEADLINES:(.*):FORMAT:(.*)::: - This LunpaCMS code does the following.
:::HEADLINES:(.*):ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::HEADLINES:(.*)::: - This LunpaCMS code does the following.

#NEWSMANAGER IMAGE NEWS BLOCK
:::NEWSMANAGER_IMAGE_NEWS_BLOCK:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.

#EVENTS
:::SHOW_EVENTS:(.*):FORMAT:(.*)::: - This LunpaCMS code does the following.
:::SHOW_EVENTS:(.*)::: - This LunpaCMS code does the following.

#ADMIN_MENU
:::ADMIN_MENU::: - This LunpaCMS code does the following.
:::ADMIN_MENU:ARGS:\s+type=(.*)\s+::: - This LunpaCMS code does the following.

#CONTECT MANAGEMENT SUITE COPYRIGHT
:::COPYRIGHT_NOTICE::: - This LunpaCMS code does the following.

#PHOTO MANAGER
:::PHOTO_DELETE:([^:]*)::: - This LunpaCMS code does the following.
:::PHOTO_MOVE:([^:]*)::: - This LunpaCMS code does the following.

#NEWS MANAGER
:::IMAGE:newsmanager_random:(\d+) ::: - This LunpaCMS code does the following.
:::NEWSIMAGE:(.*):ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::NEWSIMAGE:(.*)::: - This LunpaCMS code does the following.

#IMAGE RESIZE/BORDER ENGINE
:::IMAGE:(.*):ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::IMAGE:(.*)::: - This LunpaCMS code does the following.

#PNG MATTING
:::MATTEPNG:(.*):ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.

#STANDARD MESSAGE
:::MESSAGE:(.*):ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::MESSAGE:(.*)::: - This LunpaCMS code does the following.

#DEMO OF ALL FONTS AVAILABLE TO SYSTEM
:::FONT_?DEMO:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::FONT_?DEMO::: - This LunpaCMS code does the following.

#DEMO OF IMAGE PROTECTION HALO
:::HALO_?TEST::: - This LunpaCMS code does the following.
:::HALO_?TEST:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.

#SCREENSIZE TEMPLATE NEEDED
:::SCREENSIZE::: - This LunpaCMS code does the following.

#CREDIT CARD LOGOS
:::CREDIT_CARD_LOGOS:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.

#FILE LISTER
:::FILE_LISTER:(.*)::: - This LunpaCMS code does the following.

#CONTACT_MANAGER
:::CONTACT_MANAGER_SET:(.*)::: - This LunpaCMS code does the following.
:::PHONE_TYPE_SELECT_BOX:([^:]*)::: - This LunpaCMS code does the following.
:::CONTACT_NUMBER_BLOCK:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::CONTACT_ADDRESS_BLOCK:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.

#CAPTCHA IMAGE VERIFICATION
:::CAPTCHA:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::CAPTCHA::: - This LunpaCMS code does the following.

#REGISTRATION MANAGER
:::REGISTRATION_LIST:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::REGISTRATION:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::REGISTRATION_PAYMENT_OPTIONS::: - This LunpaCMS code does the following.
:::REGISTRATION_TICKET_QUANTITY::: - This LunpaCMS code does the following.
:::REGISTRATION_ADMIN_AUTOFILL_LIST::: - This LunpaCMS code does the following.
:::REGISTRATION_TICKET_PRICE::: - This LunpaCMS code does the following.

#STORE MANAGER
:::STORE_LOCATOR::: - This LunpaCMS code does the following.
:::STORE_LOCATIONS::: - This LunpaCMS code does the following.
:::STORE_LOCATOR_GOOGLE_API_CODE::: - This LunpaCMS code does the following.

#EMPLOYEE MANAGER
:::EMPLOYEE_MANAGER_MAIN::: - This LunpaCMS code does the following.
:::EMPLOYEE_MANAGER_RANDOM_MINI_BIO:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.

#NEWSLETTER MANAGER
:::NEWSLETTER_ARCHIVES?:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::NEWSLETTER_SUBSCRIBE_FORM:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::NEWSLETTER_SUBSCRIBE_FORM::: - This LunpaCMS code does the following.

#MEMBERSHIP MANAGER
:::MEMBERSHIP_BALANCE::: - This LunpaCMS code does the following.
:::MEMBERSHIP::: - This LunpaCMS code does the following.
:::MEMBERSHIP:PAYMENTFIELD:(.*)::: - This LunpaCMS code does the following.

#PAYPAL MANAGER
:::PAYPAL::: - This LunpaCMS code does the following.
:::PAYPAL:(.*)::: - This LunpaCMS code does the following.

#META DATA
:::META_TITLE::: - This LunpaCMS code does the following.
:::META_KEYWORDS::: - This LunpaCMS code does the following.
:::META_DESCRIPTION::: - This LunpaCMS code does the following.

#COLOR MANAGER
:::PALETTE:ARGS:\s+(.*)\s+::: - This LunpaCMS code does the following.
:::PALETTE::: - This LunpaCMS code does the following.

FCK Editor

The FCK Editor is a "what you see is what you get" (WYSIWYG) alternative editor, supported by Template Manager.When enabled by the LOCAL_TEMPLATEMANAGER_ENABLE_WYSIWYG_EDITOR map, the FCK Editor can be used to edit almost any template.

A key part of the FCK Editor functionality is that all opening HTML tags are "matched" with respective closing tags. LunpaCMS depends on unmatched tags in templates like main-begin and main-end to form the "bread" surrounding the main content of a webpage "template sandwich". FCK Editor is automatically disabled for such templates to prevent inadvertent damage to a website's layout.

Ace IDE

Ace is an embedded javascript code editor integrated into the LunpaCMS Template Manager and News Manager.

To enable this editor option, set the LOCAL_TEMPLATEMANAGER_ENABLE_WYSIWYG_EDITOR map to 1, and click "Ace IDE" in a template's contents field. Default syntax highlighting is HTML, with 'css' being set automatically if a template starts with the string 'css'. Editor options are available by pressing Ctrl+Comma or Command+Comma, but note that these options are not persistent and will be reset on the next page load. Template saves can be triggered by pressing Ctrl+Enter. Further keyboard shortcuts are documented by Ace.

Social Media Sharing

Links to share pages on a site powered by LunpaCMS can be easily done by adding the :::SOCIAL_MEDIA::: tag where you want the links to show up on the template. LunpaCMS tracks all of the clicks on these links to various social media sites. Admins can access the statistics by going to the template manager admin page and clicking on "Template Statistics." On this page, the statistics for each sharing method as well as collectively can be viewed.

When users use the links generated by the :::SOCIAL_MEDIA::: tag, LunpaCMS keeps track of the statistics. To access these statistics, navigate to the admin page, then to Template Manager and click on "Template Statistics." From there, the statistics can be sorted by type of sharing, or by time period.

Enabling Comment

You can enable comment feature on your templates by adding the :::TEMPLATE_COMMENTS::: tag to the place you want it to show.

By default, all template comments require moderation process before they are allowed to be posted on the site. To moderate comments, go to the Template Manager Admin page, click "Moderate Comments" and review the comments to moderate. In order to skip moderation, set the LOCAL_TEMPLATEMANAGER_COMMENT_AUTO_APPROVE map to 1, and comments will be posted as soon as they are entered.


Add Your Comment


(Only a limited set of HTML tags such as <b>, <i>, <u> are allowed. Embedded flash video from Youtube or Vimeo are also supported.)


Copyright © 2018 Peregrine Computer Consultants Corp. All rights reserved.

About Lunpa, our mascot. Her mother was a hamster and her father was an ill-tempered Chilean M00se. Oddly, neither smelt of elderberries.
The artist is Jennifer Lomax.