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.

Тэги шаблона

Once you have the file layout and style created, the next step is to use our тэги шаблонов to show the content that will come from GetSimple.

For example, if you want to show the title, link and body inside your template, use something like this:

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

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

These are some tips to help development of themes for GetSimple

  • There are many optional settings located in the /path/to/getsimple/gsconfig.php file. Includes CKEditor, file upload, security, language and sitemap settings.
  • To turn on debugging, uncomment the GSDEBUG line in /path/to/getsimple/gsconfig.php to enable full PHP errors to help debug.
  • If you want to see all PHP errors written to a log, check out /path/to/getsimple/data/other/logs/errorlog.txt - It is automatically generated by the system regardless of the GSDEBUG setting.
  • Add the file /path/to/getsimple/theme/your-theme/functions.php into your theme to add custom functions that can be used within your theme.
  • Add a image of your theme as /path/to/getsimple/theme/your-theme/images/screenshot.png to enable the theme image that shows when it s activated in the administrator panel.
    • Be sure to name it that exact name or else our system will not pick it up. Lowercase AND in the folder /images/ AND named screenshot.png
  • Add the code below to the top of any PHP file within your theme. This will stop any unwanted direct access to that particular file.
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); } ?>
ru/themes/creation.1379053886.txt.gz · Last modified: 2013/09/13 06:31 by Arkady