Design and themes

Typically, sites do not use the original CMS to the original design. Webmasters integrate their design templates, make improvements in their codes of modules files (we call it the "customization"). The webmaster can very long process DIAFAN.CMS, changing modules "under him", affecting a lot of system files in different folders.

For the convenience of ordering and administration of such changes in DIAFAN.CMS exist Design and themes.

Attention!
Theme – a set of user files, which differ from the standard DIAFAN.CMS files made in a separate folder custom, preserving the hierarchy.

Theme may be required to:

  • transfer completion to another site on DIAFAN.CMS or teased with the community;
  • quickly and easily change the design of the site;
  • protect their completion of the update.

How to create a theme

  • When updating the system and receive new files, DIAFAN.CMS itself determines you change the file, comparing them with the stored copies at the point of return. During the upgrade topic sgenenriruetsya automatically and all the "custom" will transfer the files in the folder custom .
  • After the completion of modules and / or the introduction of its design, the user can go to the module "Design and themes", click "Generate theme," and all the "custom" will transfer files automatically to a folder custom.

Generate theme

  • When transferring threads from another site, you must first create and apply a new theme, and then copy the files to a portable theme in the theme folder. It will be created in the folder custom. When manually transferring sure to preserve the folder structure is included in the theme.
Attention!
Remember, the current theme files have priority over those system files! Therefore, if you are implementing your design, corrected file system standard demo template themes/site.php, after the creation of the theme file will move to the folder custom/theme_name/themes/site.php, and on-site themes/site.php restored original DIAFAN.CMS file! The same applies to all other files that you touch, including css/style.css, which after generating topics will be addressed as custom/theme_name/css/style.css, etc.

Example:

Webmaster previously made changes in the subject, and / or apply updates. As a result, the site several themes, one of which is currently used. For example, this current theme is "mytheme", respectively its files are stored in the folder custom/mytheme.

If the webmaster of the need to correct the appearance of the news list, you must edit the file custom/mytheme/modules/news/views/news.view.list.php. Changes are displayed on the site, because it is the current theme.

A common mistake that webmasters make, forgetting that they have applied the theme. Instead of the current theme file rule "deceptively similar" source file system modules/news/views/news.view.list.php. All changes in this file will not be displayed on the site, because the display priority have similar files in the folder of the current theme custom/mytheme.

So, if you come across the fact that changes in theme files are not displayed on the site – check what topic you are editing your current or base "from the box."

You can also apply directly nesolko topics. Then they will isopolzovatsya on the site during the installation procedure. The priority will be the last installation. In the list of the themes applied are displayed above the rest, in the order of application. First, those that were used before. Then those used later.

Example:

On the site are two themes used. First theme is my, then theme my1. Both themes have a file modules/news/news.php . The site will be used file from the folder my1, because this theme is applied later.

If some files are only in the topic my, they will be used.

How many themes can be created for each site?

Plenty. Switch between them very much. You just need to apply the theme and disable the old theme. The most common themes are used for fast design changes, when downloading templates or transfer sites.

How to move a theme from one site to another?

First you need to save all the "custom" file generated by the theme. Then just download the theme file from one site and create a theme on another site, adding the downloaded file in the "Import themes".

Can the theme be empty?

Maybe, though practical sense it does not. If you create a new topic, and anything else it is not done, the theme folder in the folder custom appears, create a theme will be "counted" in the system. Only no effect on the display of the site is, of course, will not. Download a blank subject in a ZIP-archive is also impossible.

Demo content for theme

If you create a template for the add-ons site, you can add them to your theme demo content, which will help better understand the purpose and scope of the template. The oscillator has DIAFAN.CMS demo content. To add the demo content you need:

  • fill site as it is to see the customer template;
  • remove (including from the basket) all unnecessary data, disable the extra modules;
  • click "Add to the current theme demo content."

After that, in your current application will be subject to the installation files of content modules. Content modules will be installed, if you download a theme during installation or reinstallation DIAFAN.CMS module interface "Add / Remove Modules".

Connection

Подключаемая часть – файл modules/custom/custom.inc.php. В нем описан класс Custom_inc. В модуле к объекту класса можно обратиться через переменную $this->diafan->_custom. Экземпляр класса создается при первом вызове переменной.

Методы

array generate () – Генерирует тему из кастомизированных файлов.

Example:

// generate theme
$result = $this->diafan->_custom->generate();
if(!
$result)
{
    echo
'The theme is not generated. No customized files.';
}
else
{
    if(
$result["custom"])
    {
        echo
'Customized files: '.implode(' ',$result["custom"]);
    }
    if(
$result["return"])
    {
        echo
'Recovered files: '.implode(' ', $result["return"]);
    }
}
// output: files list

Files

  1. modules/custom/admin/custom.admin.php – Темы;

  2. modules/custom/admin/custom.admin.demo.php – Демо-данные для темы;

  3. modules/custom/admin/js/custom.admin.edit.js – Редактирование темы, JS-сценарий;

  4. modules/custom/admin/js/custom.admin.js – Темы, JS-сценарий;

  5. modules/custom/custom.export.php – Экспорт темы;

  6. modules/custom/custom.inc.php – Подключение модуля;

  7. modules/custom/custom.install.php – Module installation.