CMS

From Group-Office Groupware and CRM Documentation
Jump to: navigation, search

To enable the CMS you need to install / enable the mod_rewrite module for Apache.

More info about mod_rewrite can be found here: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

You must know the Site ID of the website. This can be found in Group-Office at:

Websites -> Sites -> Double click the site

Then you must add the following rewrite rule to your VirtualHost section:

<VirtualHost *:80>
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /var/www/yourdomain.com
<Directory /var/www/yourdomain.com>
RewriteEngine On
RewriteBase /groupoffice/modules/cms/

#allow robots.txt
RewriteRule ^robots\.txt$ - [L]
RewriteRule ^(.*)$ run.php?site_id=<The Site ID here>&path=$1&basehref=/&%{QUERY_STRING}
</Directory>
<Directory /var/www/yourdomain.com/groupoffice>
RewriteEngine Off
</Directory>
</VirtualHost>

The rewrite base might be different in your environment. Here Group-Office is located in /groupoffice and the website runs at the top level.

If Group-Office already runs at the top level this setup won't work. In that case you create a dummy location:

/var/www/yourdomain.com

In that folder you must create a symlink called "groupoffice" that points to Group-Office. You also create a copy of the config.php file and put it in /var/www/yourdomain.com. Make sure that the original config.php file is not located in the Group-Office source directory otherwise it will always use that config.php file. Group-Office searches trough each parent directory for the config.php file, in /etc/groupoffice and in /etc/groupoffice/yourdomain.com


Variables available in the templates

$site contains all the site properties:

.id = ID of the site
.name = Name of the site
.webmaster_email = Domain


$cms_url = the URL to the CMS module
$template_path = the filesystem path to the template directory
$template_URL = the URL to the template directory
$go_url = the URL to Group-Office
$modules = An array with module information
$images_url = The URL where the public files of the CMS editor are stored
$images_path = The filesystem path where the public files of the CMS editor are stored


$file is an array with the following members:

.id = id of the file
.type = type of the folder defined in config.xml
.folder_id = id of the file's folder
.extension = file extension
.size = filesize
.ctime = Unix timestamp of the creation time of the file
.mtime = Unix timestamp of the modification time of the file
.name = Name of the file
.content = Contents of the file
.title = Meta title of the file
.description = Meta description of the file
.keywords = Meta keywords of the file

$folder
.id = of the folder
.type = type of the file defined in config.xml
.parent_id = parent folder id
.ctime = Unix timestamp of the creation time of the folder
.mtime = Unix timestamp of the modification time of the folder
.name = Name of the folder
.disabled = Disabled folder (0 or 1)

Functions

To get a list of items from a folder you can use the following command:

{items}

This function has the following parameters. They are all optional
$root_path = Path to the parent folder of the items to list
$root_folder_id = ID of the parent folder of the items to list
$level = Display items of a level in the folder structure. (Path: /Products/Monitors To list the Monitors folder the level is 1, to list the Products folder the level is 0)
Use one of the above parameters optionally. If they are omitted it will list the items of the active folder. That is the folder of the file that the visitor is currently viewing.

$expand_levels = Defaults to 0 if you set a value it will expand into a treeview when a folder is clicked.
$expand_all = true or false to expand all levels. Defaults to only expand the selected folder. $no_folder_links = Only useful with expand_all=true. Folders will be rendered as div tags. $class = Pass a class name to the items.

$item_template = Use a sub template file for each item
$active_item_template = Use a sub template file for the active item
$max_items = The maximum items to list.
$wrap_div = true or false to put a <div class=""></div> around each level $random=Show random items. Useful together with max_items $reverse=Sort in reverse order $no_folder_links=Don't make links to folders $start=Start at offset $level_template=Smarty template to use for each level of the tree

Variables

When you use item_template and active_item_template you can use the following variable in the templates:

$item
.type = type of the file or folder defined in config.xml .folder_id = id of the file's folder (file only) .parent_id = id of the folders' parent (folder only) .extension = file extension .size = filesize .ctime = Unix timestamp of the creation time of the file .mtime = Unix timestamp of the modification time of the file .name = Name of the file .content = Contents of the file .title = Meta title of the file .description = Meta description of the file .keywords = Meta keywords of the file .name = name of the item
.fstype = file or folder
.content = content of the item (Files only)
.title = title of the item
.id = id of the item
.href = URL to the item
.option_values = values from the config.xml that come from the <input>'s
.index = the ascending index number of the item .safename = The filename without possibly unwanted characters for filesystems for example. .level = The level of the item in the folder structure. (Path: /Products/Monitors To list the Monitors folder the level is 1, to list the Products folder the level is 0)


$parentitem = The parent folder of the item
$content = An autogenerated link
$level = The level of the item in the folder structure. (Path: /Products/Monitors To list the Monitors folder the level is 1, to list the Products folder the level is 0)
$is_in_path = true if the item is in the path that the visitor was currently viewing
$last_was_in_path = true if the last item in the loop was in the path that the visitor was currently viewing
$even = True if the index is even

{files}

This function can list files from the Group-Office file manager $path = The relative path to the folder to list. It defaults to the path identical to the current CMS file that is viewed. $template= The template file to use for each file listed.

Variables

When you use item_template and active_item_template you can use the following variable in the templates:

$file
.name = name of the item
.friendly_name = _ shown as spaces
.path = absolute path on server
.relpath = Relative path from $config['file_storage_path']
.mtime = modification time .size = size of file .type = MIME type

Use Group-Office user authentication on a page

If you want a page to use Group-Office user authentication you can set this up in the following way Put this in your template:

{go_authenticate}