Documentation SGEngine 2.2
1. IntroductionSGEngine - is a multipurpose and flexible in configuration Content Management
System (CMS), which is written in programming language Perl.
So, if you are not Perl programmer also even do not know HTML, you can quite install SGEngine without someone's help and take advantage of one of prepared templates. If you are HTML guru or even be good on it, you are on forces to create own design and to use prepared modules. Well and if you besides work with programming language Perl, you can create own modules to your new site! 2. What's new?
+ Captcha - protection against spam-robots in guestbook and in comments The given documentation changes with each version. To receive the most extensive and clear representation about innovations in last version of this engine, we advise to familiarize with a variant of the documentation where all changes are noted by color. 3. Installation3.1 Upgrading from the previous versionsIf the version 1.1 or below of SGEngine has been already installed, consider that you does not become the current version 2.0 installed on top! However you can keep bases of news, comments and guestbook. They can be translated in a new format later. To install the new version of the engine with old bases do the following:
If you have installed version 2.0 or above, it is necessary to do following steps:
3.2 New installation
3.3 End of installationIf all has passed successfully do not forget to remove scripts cbase.pl and setup.pl, or to move them to the directory, where anybody except for you cannot start them. If there were problems go to our forum. 4. Core system and the basic functionsSGEngine is written in programming language Perl, that basic and distinctive property is fast and flexible work with text files. Whole package consists of two types of documents:
Templates consist only from content files. Modules are scripts which use modular templates for a conclusion of the information. 4.1 Structure of files and folders
4.2 TemplatesEach template of SGEngine represents a set of text files written on html, and also a file of Cascading Style Sheets. Cascading Style Sheets file is in directory /www/css. Html files could be found in the subdirectory of /tmpl, having a unique name and being name of a template. They share on two groups:
StructuralThese template files, except for standard html-tags, contain internal tags of engine, which allow substituting other files of the template on their place, to start on this place a module or to substitute a variable from the language package. If the substituted file of the template also has internal tags they will be processed too. By default it is allowed to have 10 enclosed levels, this number can be changed in the configurations file. In structural templates following internal tags are used:
ModularThese templates are used by modules and have extension .tmpl; their primary goal is to facilitate creation and editing of website design. With them it is not necessary each time to get into code of modules and try to discover html lines. Each module can use several templates and even to have the shared with others that besides saves time for correction. A modular template also as well as structural represents the text with html marking, into certain parts of which are variables of this module inserted. All these variables are described in the beginning of a modular template and look like: [%VARIABLE%]. The important areas of a template actively used by modules are marked out <!--AREA--><!--END:AREA-->. Template settingThe website visitors can choose one of templates for permanent using. The template is set with the reference constructed as follows: http://www.your_domain.zone/language/set_template/template Where, language - a kind of language (ru, en, de). This word is absolutely identical with the name of the directory, where dependent on language bases and logs are stored, and also the directory with text and HTML files; The name of this template is written in a cookie file which should be supported by browser. It enables each visitor to set the liked template and to see the website in that kind in which he find it most of all attracted. 4.3 ModulesModules are the executed scripts written in programming language Perl. They give dynamic to a website working on SGEngine CMS. As a matter of fact, modules are not independent programs, it only a piece of the code which is called from the basic script index.pl. Therefore, to create a module it is necessary to know the following:
Parameters can be passed to the module through the reference. For example: http://www.your_domain.zone/language/module/param_1/param_2/.../param_n Where, language - a kind of language (ru, en, de). This word is absolutely identical with the name of the directory, where dependent on language bases and logs are stored, and also the directory with text and HTML files; 4.4 Configurations fileThe configurations file config.ini stores the basic CMS settings. It will be created by "Setup wizard" (setup.pl) during installation. This file consists of comments lines beginning with the sign # ignored by engine, and also the lines defining configurations variable. Such lines look like: variable_name variable_value Furthermore in the configurations file work "aliases" which are designated %alias%. These are the variables certain earlier. For example: path /home/sgengine2 In this case the variable log_dir will matter /home/sgengine2/log 4.5 Multilanguage supportThe language package is constructed in a similar way as the configurations file see 4.4 Configurations file. The website visitors have the possibility to choose, in what language contents of the website will be displayed. Language is set with the reference constructed as follows: http://www.your_domain.zone/old_language/set_lng/new_language Where, old_language, new_language - a kind of language (ru, en, de). This word is absolutely identical with the name of the directory, where dependent on language bases and logs are stored, and also the directory with text and HTML files; That to the chosen language be active in all parts of the website, it is necessary to fulfill the following conditions:
However if the condition 2 and 3 are not fulfilled or fulfilled not completely, the website will work correctly and without errors! For example, you have decided to not post news in German then you do not put news base in the directory /log/de. During processing of files, the engine will not find German base and will use a file stored in the directory of the language specified by /log/ru. The same is valid for text and HTML files. Important! Relative links inside of structural and modular templates should not contain a kind of language as the SGEngine itself substitutes it during processing. Usual html files can use this opportunity too. For example, referring to the module of the guestbook, it is enough to specify /guestbook. 4.5 Text and HTML filesSGEngine allows to output usual text and html files in the dynamic part of the website by means of the module 5.1 Output of text and HTML files, or through a corresponding internal tag <engine txt{file.html}>. Thus html files will be outputted according to html marking, and text files which should have necessarily extension .txt as is! In other words, if in a text file there is a paragraph, a space or line feed, on the website the paragraph, a space or line feed will be displayed. 4.7 AdministrationFor management of SGEngine the special administrative part of the website with own modules is provided. It is closed for the usual visitor by the password. Only following types of users have access to this area:
The administrator can add, delete moderators, downgrade or upgrade them, and also defines, which modules those have the right to start. Also the administrator sees all news posted on the website. To the moderator only those news are accessible, which it has added itself. The administrative part should be necessarily protected by the password. Not authorized users have no access to this part of engine. For the organization of access please use the /cgi-bin/.htaccess file 5 Modules available in this packageSGEngine offer a solid package of already prepared modules which quite suffices for high-grade work of many websites. With each version of the engine, modules are updated and improve, their number grows constantly. 5.1 Public modulesThis group of modules is accessible to all visitors of the website NewsThis module outputs news in a blog form. The number of outputted news is adjusted in the configurations file. If a tag <!--cut--> will be found, the text after it will not be outputted, and the link "read next" will be deduced. It allows cutting off very long news and not "inflating" a blog. News viewingThis module outputs the full text of news which unique number is passed by parameter. The tag <!--cut--> is ignored by this module. News archiveThis module outputs news in the form of more reduced blog. News is cut off on tags <!--cut--> and <br>. The page rule is deduced below. From this module all news are accessible. News commentsThis module outputs news completely and all comments to it. By means of the form, this module allows visitors to leave comments to news on the website. The form uses smiles which can be disabled by changing a corresponding variable in the configurations file. The module also writes IP-address of the author of each message. If the visitor will be found out in ban-list, he cannot write to the guestbook. If a forbidden word from the bad words list will be found in the message, it will not be sent. Comments are protected by 5.1 Captcha - protection against spam-robots module. RSS - news feedThis module outputs the news in format RSS. Requested URL looks as follows: http://www.your_domain.zone/language/rss Where, language - a kind of language (ru, en, de) in which the news feed will be outputted. Condition - availability of the news base in a language folder; Output of text and HTML filesThis module allows to output text and html files. The path to a text file is passed by parameter. If the text file will not be found in a directory of language, which was chosen by the visitor, the module will output a file, which is stored in the directory of the language specified by default. Important! The passed path should not include the language directory itself! See also 4.5 Text and HTML files Feedback formOutputs the form which allows visitors of the website to send a e-mail on the address of the administrator specified in the configurations file. It is a reliable way to hide the e-mail address from the spam-robots. Files downloadThis module allows visitors to download files from the website and thus to keep a log with number of downloading's. Thus the server directory where files are storing remains invisible for visitor and is defined in the configurations file. The reference to a file, for example archiv.zip, should look as follows: /dl/archiv.zip Last updatingOutputs last updating date which is being written by the adding news module in a separate log file. GuestbookThe guestbook module allows website visitors to leave messages and wishes. Messages are outputted in a belt form with a pages rule. The number of messages pro page is defined in the configurations file. The module also writes IP-address of the author of each message. If the visitor will be found out in ban-list he cannot write to the guestbook. If a forbidden word from the bad words list will be found in the message, it will not be sent. Guestbook is protected by 5.1 Captcha - protection against spam-robots module. News searchingThis module holds a search of words or phrase in news. The result is being given out in the comfortable and easily adjusted form. The basic features:
Captcha - protection against spam-robotsThis module protects message send forms from spam-robots. The visitor get a picture, which containing a casual combination of letters and figures, which he should enter into a corresponding field of the form. Navigating menuThe module processes a menu language package and outputs the navigating menu, according to the modular template. Menu can have two levels of an enclosure. 5.2 Administrative modulesThis group of modules is accessible only to the administrators and moderators in an administrative part of the website. News managerThis module allows posting recent news to the website, deleting or editing of existing. There is a preview of news function and a tools panel which include buttons to insert the html-tags, the form to URL adding and the form to uploading image files with next placing in news. For such files it is possible to automatically create thumbnails (presence of Perl libraries Image:: Magick or GD plus Image:: Size is necessary). The module determines, under what name the user has logged in, and take it as a name of the news author. After news will be added, the module clears the cache of the search module. By means of this module it is also possible to manage comments of news. There is a possibility of editing, removal, putting of the author in the ban list, and also additions of comments on behalf of logged in user. The administrator has access to all news of the website, and the moderator only to own. Also see. 4.7 Administration File managerThis module outputs the structured list of files and directories on a server, allows to move on it and to make the basic actions: creation of new objects, renaming, removal, editing. There is also an opportunity of loading of any quantity of files on a server. Administrating of guestbookBy means of this module the advanced administration control of the guestbook is managed. The administrator can leave answer to each message, or remove/correct the message. Together with records of the guestbook, IP address of the author is showed and there is a possibility to ban on it or by name. Ban-list / Bad words
This module outputs the list of banned IP addresses and forbidden words. Extensive support by both lists: addition, editing, removal. At change of lists the additional analysis is tacked - existing words and addresses will not to be added repeatedly. There is an automatic determination of presence of several addresses at one subarea and the offer to add it all. Statistic and administrating of downloaded filesThe Module outputs the list of files accessible to downloading, the general number of downloading's for every file, and also number of new downloading's from the moment of last user visiting. Allows zeroizing statistics or to remove a file from the list. The file himself will not be removed! Search loggingShows all the words saved in the cache of search in news. There is a possibility of manual cash clearing. Access managerThis module allows administrator to add new users, to delete old, and also to change passwords. Besides there is a possibility to downgrade them to moderator or to upgrade to administrator. The moderator can change own password by means of this module. Also see 4.7 Administration 6. TO DOIt is planned in the future versions: - New templates |