Simple 302 Redirects To Another Page Andrei M. 25.11.2014

Simple 302 (status Found) Redirects provides an easy method of redirecting requests to another page of your website or elsewhere on the web. It's especially useful when you migrate a site or reference to external source.

The predefined default page will be opened by requesting of domain name.


When it is start_page_name, then the request like will be redirected to

Every page can be defined as URL in menu manager. 

In this case the requests like or will be redirected to http://my_new_domain.

- Up -

Navigation Schema in ZAPms Andrei M. 14.09.2014

The structure of the Website is the basis for the construction of navigation on it. For example take the following tree of structure:

Group A
-     Type AA
-     -     Product ABC
-     -     Product ABD
-     Type AB
Group B
-     Type BA
-     Type BB

Main menu

The main menu of the Website contains links to the first level of the tree:


Code of Template for the main menu:


<ul style="list-style-type:none;">
{section name=custom loop=$menu_list}
  {if $menu_list[custom].active>0 and $menu_list[custom].level==0}
  <li style="float:left;">
    <a href="{$menu_list[custom].name}" style="padding-left:20px;">{if $menu_list[custom].active==3} -> {/if}
<div style="clear:both;"></div>

Breadcrumb menu

The breadcrumb menu is necessary if the structure contains more than two levels:

Group A   Type AA   Product ABC

Code of Template for the breadcrumb menu:


{section name=custom loop=$path_list step=-1}
  {if $smarty.section.custom.index==0}
    <a href="{$path_list[custom].name}">{$path_list[custom].title}</a> &nbsp;

Secondary or submenu

In case the submenu is needed, which references to only one particular level for example for Group A:

Code of Template for the submenu:


<h1>Fixed Menu Types of Group A</h1>
<ul style="list-style-type:none;">
{section name=custom loop=$menu_list}
  {if $menu_list[custom].active>0 and $menu_list[custom].level==0}
    <a href="{$menu_list[custom].name}"{if $menu_list[custom].active==3} style="font-width:bold;"{/if}>{$menu_list[custom].title}</a>

Submenu as tree for the current selected menu item:

Code of Template for the submenu in tree form:


<ul style="list-style-type:none;">
{assign var="clevel" value=1}
{section name=custom loop=$menu_list}
{if $menu_list[custom].active>1 and $menu_list[custom].level>0}
  {if $clevel>$menu_list[custom].level}
    {assign var="closes" value=$clevel-$menu_list[custom].level}
    {assign var="clevel" value=$menu_list[custom].level}
    {section name=iopens loop=$closes}
  {if $clevel<$menu_list[custom].level}
    {assign var="clevel" value=$menu_list[custom].level}
     <ul style="list-style-type:none;"><li>
  <a href="{$menu_list[custom].name}"{if $menu_list[custom].active==3} style="font-width:bold;"{/if}>

In general case the function which calls the tree will return an menu array as follows:

Name Title Id Parent Level Status
sample_about About 1094 1083 0 2
sample_contact Contact 1093 1083 0 2
sample_group_a Group A 1084 1083 0 2
sample_type_aa Type AA 1086 1084 1 2
sample_product_abc Product ABC 1090 1086 2 3
sample_product_abd Product ABD 1091 1086 2 2
sample_type_ab Type AB 1088 1084 1 2
sample_group_b Group B 1085 1083 0 2
sample_type_ba Type BA 1087 1085 1 1
sample_type_bb Type BB 1089 1085 1 1

where status:
0 - disabled
1 - enabled
2 - displayed
3 - clicked

- Up -

Role of Structure, Interface and Templates Andrei M. 05.09.2014

The structure of product or service is reflected in the structure of the Website. The Website structure can be formalized in the form of a tree or a list.

The elements of structure are displayed through the graphic design. Its role is to facilitate the perception process and provide a GUI to interact with the visitors of the website.


When the graphical representation of a website is ready in the form of image, it is helpful to create a prototype as .html file. Layout will show how well the GUI fulfilling its purpose.

Ready layout of prototype is divided into parts to avoid redundancy and simplify further support of website. Such parts are named templates. Templates can contain a title, a container for the content or the menu container.


The templates and content are linked to elements of the site structure, which is represented as a menu on the website. Website content is stored in the form of html files on the server or in a database.

The template files of zapms are located in the folder /files/templates/

site_default.tpl the basic template contains the references to the content and menu containers
menu_top.tplmenu_news.tpl contain function calls to display menu
menu_download.tpl contains static text with links to download the files
menu_galery_about.tpl calls the screenshots to display in the menu area
menu_news.tpl calls the news from the database to display in the menu area
content_default.tpl displays static content
content_news.tpl calls the news from the database to display in the main content area

Static content and images are located in the folder /files/content/

sample_content.txt sample file with static content.

- Up -

Install on Raspberry PI Andrei M. 28.08.2014


Zapms installation

Copy Zapms and unzip it locally. Then copy or move to pi. Suppose you Raspberry PI has the IP address

scp -r /home/USER_NAME/zapms_for_raspberry_pi pi@

Loggin to the pi.

ssh pi@

Copy Zapms to the www directory. Suppose an owner group for directory www is the www-data (Property of the Web Server lighttpd).

sudo -g www-data cp -ru /home/pi/Desktop/zapms_for_raspberry_pi/* /var/www/

Add the permissions

sudo chmod 777 /var/www/auth/ /var/www/include/ /var/www/files/ -R
sudo chmod 777 /var/www/zap/include/ /var/www/zap/cache/ /var/www/zap/templates/ /var/www/zap/templates_c/ -R

Create database

mysql -p -u root
mysql> create database zapmsdb character set utf8 collate utf8_general_ci;
mysql> grant all privileges on zapmsdb.* to 'pi'@'localhost';
mysql> flush privileges;
mysql> quit;

Define the rules for web server. Sample file can be found under setup/lighttpd.conf.

sudo nano /etc/lighttpd/lighttpd.conf

Following parameters has to be added:

server.modules = (
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
fastcgi.server = (".php"=>(("bin-path"=>"/usr/bin/php-cgi","socket"=>"/tmp/php.socket"))) 

# direct access is denied for bibliothek and images
$HTTP["url"] =~ "^/(auth|include|files/content/images/originals|zap/include)/" {

url.access-deny = ( "" )
server.error-handler-404 = "403"

# direct access is denied for modules
$HTTP["url"] =~ "^/(modules|zap/modules)" {
url.access-deny = ( "index.php" )
server.error-handler-404 = "403"

# rewrite urls
url.rewrite-if-not-file = (
"^/robots.txt" => "/robots.php",
"^/sitemap.xml" => "/sitemap.php",
"^/crossdomain.xml" => "/crossdomain.php",
"^/files/(.*)$" => "$0", # no restrictions for static content
"^/([^.?]*)$" => "index.php?m=$1", # default controller
"^/([^.?]*)?(.*)$" => "index.php?m=$1&$2", # other requests
"^/$" => "/index.php" # default page

Verify the syntax and restart the web server

lighttpd -t -f /etc/lighttpd/lighttpd.conf
sudo service lighttpd restart

Run setup in browser

Login into Backend.


Optional setting up of crontab

Setup crontab for daily restart

sudo -u pi crontab -e

# restart once a day
51 23 * * * sudo reboot -h

Start crontab

sudo nano /etc/rc.local
--> add line before exit 0
/etc/init.d/cron start

Monitoring crontab

sudo tail -f /var/log/syslog | grep CRON

- Up -



zapms v1.52 basic 2,5 MB

zapms v1.52 raspberrypi 2,5 MB

Live Demo
Login: demo
Password: demo