Creating a new extension
The easiest way to create a new extension is make a copy of the existing one (for example from default extension "Saurus 4") and then delete unnecessary files and folders. The alternative is to create an empty extension folder and start adding system files and folders into it.Check-list for creating a new extension
- Create a new folder and give it a good self-explaining name. Do not use spaces and special characters in the folder name.
- Copy file "extension.config.php" from sample extension folder to the new folder.
- Open file "extension.config.php" and modify following configuration settings:
- name, title, description, author, version, version_date
- icon_path, min_saurus_version - optional
- Create necessary folders for CMS templates:
- content_templates/
- page_templates/
- object_templates/
- Create a new template file "test.html" for testing and save it into the content_templates/ folder.
- Open file "extension.config.php" and modify template configuration settings:
// The array of templates
$EXTENSION['templates'][] = array(
"name" => "Test template",
"file" => "content_templates/test.html",
"is_page" => 0,
'is_visible' => 1,
'is_readonly' => 1,
); - Log in to the Saurus CMS administration area and open admin-page "Extensions > Extensions" - main Extension Manager page. Click the button "Refresh" in the toolbar to start the synchronisation routine of searching, installing and updating extensions. New extension will appear in the table.
- Open admin-page "Templates > Content templates", you will see a new "Test template" in the table. The template is also visible in the section editor in the content template selection box.
- Proceed with adding necessary files and folders to your extension folder - graphic files, styles, PHP scripts etc.
Modifying templates during website development should be done in the filesystem in the extension folder (and not in the CMS templates admin-pages) to avoid file permission conflicts.
Further developing
- To create custom admin-pages under CMS administration area menu, create folder admin/ under the extension folder and copy file "custom_adminpage_sample.php" from sample extension into it. Modify adminpages configuration settings in the extension's configuration file. Open Extension Manager admin-page and press Refresh button to synchronise all extensions. The new adminpage will appear in the admin menu "Extensions" (after refreshing admin-area menu).
- To create installation files executed during new extension installation, create folder install/. Create a new file containing SQL queries - for example to create new tables in the databases, adding/modifiying existing data in tables. SQL files must have file extension ".sql", eg "create_tables.sql". Open Extension Manager admin-page and press Refresh button to synchronise all extensions. SQL files are executed for every new extension.
- In case your templates or web application use custom CMS system words you can save them under "lang/" folder and import them easily during next deployment. Create also sub-folder with character encoding name, eg "UTF-8/".The easiest way to create extension's glossary is to add all new words and translations in the CMS admin-page "Languages > Glossary". Choose appropriate extension name in the "Type" selectbox and start adding new words. After the extension's glossary is ready, export language file and save it to the folder "lang/UTF-8". Language file is created in the fixed format and named like "language1.csv" where "1" is the language ID value.
