Changing Templates
Contentor normally uses the template specified in the system configuration _default_template setting. There are three ways to override the default setting:- Specify the template name in the URL - http://contentor.net/index/templates/changing?template=templates/misc04/template.php This setting works for only the one page linked to. Subsequent page will revert to the default template.
- Using the "set template" utility - http://contentor.net/util/settemplate.php?template=templates/misc04/template.php This sets a cookie on the visitor's browser. If cookies are enabled on their browser, the setting will last for 3 days or until the cookie is cleared.
- Adding a "template" variable to the database "pages" table. This option is explained in greater detail below.
Adding per-page templates
Add a field called "template" to your "pages" table and fill it with the default template value. In the data manager, use the "Run an SQL" to execute:
ALTER TABLE `pages` ADD `template` VARCHAR(255) DEFAULT 'template.php';
UPDATE `pages` SET `template`='template.php';
Replace 'template.php' in the example above with the full path from the root of the site to your default template.
Next, use the data manager to modify the edit screen header to allow the template value to be changed. In the "setup" table, edit the record where the "item" = "edit_header" to add one input and modify the field list:Template: <input name="template" type="text" id="template" size="40" value="$template" onchange="chg();" /> <input name="fieldlist" type="hidden" id="fieldlist" value="keywords,description,template" />
Template: <input name="template" type="text" id="template" size="40" value="$template" readonly="true" onchange="chg();" /> <input name="seltempl" type="radio" value="1" onclick="document.pageupdate.template.value='template.php';" /> Default | <input name="seltempl" type="radio" value="2" onclick="document.pageupdate.template.value='template2.php';" /> Alternate <input name="fieldlist" type="hidden" id="fieldlist" value="keywords,description,template" />Which will produce the following:
The text input field is set to "readonly" to prevent any entered value, while the radio buttons provide pre-determined legitimate values.
Note that any page that does not have an entry in the "pages" table will use the default template. This might include /calendar/ and any pages that display files or folders from the server hard drive. For example, you might link to a page: yourdomain.net/index/files that shows the files dtored in the folder "files". If you wanted to display these files in an alternate template, you could create a page called "files" (yourdomain.net/edit/files) that contained the BBCode "[folder]files[/folder]"
Note that any files clicked in the listing would then be displayed in the default template unless an entry is made in the "pages" table.