User Tools

Site Tools


themes:creation

This is an old revision of the document!


Theme Creation

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 page into a simple theme. 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 defines the html of the default page layout for most pages within your site, but you can make other page templates and set particular pages to use an alternative template by choosing it within the Page Options → Template setting:

Dynamic content is inserted into your page template by using template tags similar to WordPress (if you are familiar with that). All template pages are written in PHP.

Anatomy of a Theme

the default page template template.php goes 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.

Other files found in a template folder are:

  • Normally an external stylesheet referenced in the html of the page template file.
  • Alternative templates for pages such as homepage.php or contact.php. They will be available for selection in Page Options.
  • A file named editor.css in the theme folder will enable the CKeditor to display page content more accurately.
  • Any images used in the theme, along with favicons and backgrounds
  • An image of your theme saved in an images folder as /path/to/getsimple/theme/your-theme/images/screenshot.png will be displayed on the Theme Selection Page in the Admin Pages.1)
  • A file functions.php contains any custom functions that are used within your theme.
  • Sometimes template files are split into parts and saved as partial template files with names like header.inc.php

Theme Development Tips

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.'); } ?>

Links

Back to the GetSimple Wiki Contents Page

Pages in this Section

Themes

1)
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
themes/creation.1383258815.txt.gz · Last modified: 2013/10/31 22:33 by Timbow