This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation.

Difference between revisions of "CMS"

From Group-Office Groupware and CRM Documentation
Jump to: navigation, search
(=Variables)
(Functions)
Line 62: Line 62:
 
To get a list of items from a folder you can use the following command:
 
To get a list of items from a folder you can use the following command:
  
{items}<br />
+
==={items}===
 
This function has the following parameters. They are all optional<br />
 
This function has the following parameters. They are all optional<br />
 
$root_path = Path to the parent folder of the items to list<br />
 
$root_path = Path to the parent folder of the items to list<br />
Line 79: Line 79:
 
<br />
 
<br />
  
===Variables===
+
====Variables====
 
When you use item_template and active_item_template you can use the following variable in the templates:
 
When you use item_template and active_item_template you can use the following variable in the templates:
  

Revision as of 12:08, 24 February 2009

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:

RewriteEngine On
RewriteBase /modules/cms/
RewriteRule ^(.*)$ run.php?site_id=<The Site ID here>&path=$1&basehref=/


The rewrite base might be different in your environment. Here Group-Office is located in the DocumentRoot.


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
.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
.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.
$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.

Variables

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

$item
.type = type of the item (folder or file)
.name = name of the item
.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

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:

{if $session.user_id>0}

This content is is protected

{else}
	<p>You need to login first. If you are not redirected click the link below.</p>
	<a href="{$cms_url}login.php?site_id={$site.id}&basehref={$basehref|escape:'url'}&success_url=%2FLinktothispage">Click here to login</a>
	<script type="text/javascript">
	document.location="{$cms_url}login.php?site_id={$site.id}&basehref={$basehref|escape:'url'}&success_url=%2FDownload";
	</script>
{/if}

Please make sure you change %2FLinktothispage into the correct URL to this page. %2F is a "/" because you must encode the URL.