User Tools

Site Tools


ru:themes:creation

This is an old revision of the document!


Создание тем

If you are building a site from scratch, converting an existing site to GetSimple or you have a web page you want to use as a template you need to create a GetSimple Theme. There is a Step-by-Step Tutorial for converting a static html template into a simple theme.

Creating themes for GetSimple is extremely easy. GS uses template tags similar to WordPress (if you are familiar with that). All template pages are written in PHP. There is only one truly required theme file, and that's template.php. You then place that file within it's own unique folder name, and install it on your server.

template.php is the “Default Template” file used for most pages within your site, but you can make other files within your theme and set particular pages to use that new template file instead by choosing it within the Page Options → Template setting:

Из чего состоит тема

At the very minimum, a GetSimple theme consists of only one file: template.php. This file should reside inside a folder named specifically for your theme, and placed within the theme folder of your GetSimple installation such as: /path/to/getsimple/theme/my_theme/template.php You can rename a theme by renaming the folder that contains it.

By default all new pages use the template.php file when displayed. Developers have the ability to create other non-standard template files such as homepage.php or contact.php. The user of the cms would then choose that particular template when creating a new page.

A file named editor.css in the theme folder will enable the CKeditor to display page content more accurately.

Тэги шаблона

Как только вы сверстали сайт и закончили его стилевое оформление, наступает время применить тэги шаблона для формирования страниц вашего сайта с помощью GetSimple.

Напрмер, если вы хотите показать ссылку на страницу и контент страницы, вставьте в файл шаблона следующий код:

<a href="<?php get_page_url(); ?>"><?php get_page_title(); ?></a>
<?php get_page_content(); ?>

Советы по разработке тем

А теперь - несколько советов для разработчиков тем для GetSimple

  • Настройки системы хранятся в файле /Путь_к_GetSimple/gsconfig.php. Внимательно изучите этот файл. Настройки касаются редактора CKEditor, загрузки файлов на сайт, безопасности, языка и генерации файла sitemap.xml
  • Для включения режима отладки раскомментируйте строку GSDEBUG в файле /Путь_к_GetSimple/gsconfig.php, для отображения всех ошибок PHP.
  • Для ознакомления со всеми ошибками PHP, которые записываются в лог GetSimple, откройте файл Путь_к_GetSimple/data/other/logs/errorlog.txt. Ошибки в системном логе регистрируются вне зависимости от значения настройки GSDEBUG.
  • Если в вашей теме используются какие-то самописные PHP-функции, то их следует располагать в файле /Путь_к_GetSimple/theme/Наименование_вашей_темы/functions.php.
  • Добавляйте скриншот вашей темы в файлы темы в следующим образом: /Путь_к_GetSimple/theme/your-theme/images/screenshot.png. Этот рисунок будет отображаться в панели управления при активации темы.
  • Файл скриншота должен быть только с именем screenshot.png, только в нижнем регистре и должен находиться в папке /images/ темы. Только при этих условиях он будет обнаружен и показан системой.
  • Всегда добавляйте следующий код первой строкой в любой PHP-файл вашей темы. Таким образом предотвращается несанкионированный прямой доступ к данному конкретному файлу.
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); } ?>
ru/themes/creation.1379056377.txt.gz · Last modified: 2013/09/13 07:12 by Arkady