:banner: banners/flectra_theme_tutorial.jpg ===================== Theme Tutorial ===================== .. rst-class:: lead Flectra celebrates freedom. Freedom for the designer to go further and freedom for the user to customize everything according to their needs. Ready to create your own theme? Great. Here are some things you should know before you begin. This tutorial is a guide to creating an Flectra theme. .. image:: theme_tutorial_assets/img/flectra_intro.jpg An introduction for web designers ================================= If you are a web designer using Flectra for the first time, you are in the right place. This introduction will outline the basics of Flectra theme creation. .. note:: Flectra’s team has created a framework that’s powerful and easy to use. There’s no need to know special syntaxes to use this set of tools. From common CMS to Flectra -------------------------- .. note:: If you always think and work in the same way, you’ll probably get the same results. If you want something completely new, then try something different. .. Where is my header.php file? This is usually the first question from a web designer used to working with Wordpress or Joomla and coming to Flectra for the first time. .. container:: row .. container:: col-sm-5 .. image:: theme_tutorial_assets/img/flectra_cms.jpg .. container:: col-sm-7 Indeed, when using common CMSs, you have to code several files (like header.php, page.php, post.php, etc.) in order to create a basic structure for your website. With those systems, this base structure acts as a design foundation that you have to update over time to ensure compatibility within your CMS. So, even after you have spent hours coding the files, you have not even started on the design yet. This **does not** apply to creating Flectra themes. .. note:: We think that theme design should be simple (and powerful). When we created our Website Builder, we decided to start from scratch instead of relying on what already existed. This approach gave us the freedom to focus on the things that are really important for designers: styles, content and the logic behind them. No more struggling with technical stuff. Flectra default theme structure ------------------------------- .. container:: row .. container:: col-sm-7 Flectra comes with a default theme structure. It is a very basic “theme” that provides minimal structure and layout. When you create a new theme, you are actually extending this. Indeed it’s always enabled in your setup and it acts exactly like the CMS’s base structure we mentioned above, except that you don’t have to create or maintain it. It will upgrade automatically within your Flectra installation and, since it is included in the Website Builder module, everything is smoothly integrated by default. As a result, you are totally free to focus on design while this structure does the job of providing integrations and functionality. .. container:: col-sm-5 .. image:: theme_tutorial_assets/img/flectra_structure.jpg .. container:: row .. container:: col-md-7 **Main features:** * Basic layouts for pages, blog and eCommerce * Website Builder integration * Basic Snippets * Automatic Less/Sass compiling * Automatic Js and CSS minification and combination .. container:: col-md-5 **Main technologies:** * Twitter Bootstrap * jQuery * jQuery UI * underscore.js Thinking "modular" ================== An Flectra theme is not a folder containing HTML or PHP files, it’s a modular framework written in XML. Never worked with XML files before? Don’t worry, after following the tutorial, you’ll be able to create your first theme with only basic knowledge of HTML. Using classical web design workflows, you usually code the layout of the entire page. The result of this is a “static” web page. You can update the content, of course, but your client will need you to work on making even basic changes. Creating themes for Flectra is a total change of perspective. Instead of defining the complete layout for a page, you can create blocks (snippets) at let the user choose where to “drag&drop” them, creating the page layout on their own. We call this modular design. Imagine an Flectra theme as a “list” of elements and options that you have to create and style. As a designer, your goal is to style these elements in order to achieve a wonderful result, regardless of where the end user chooses to place them. Let’s take a tour of our “list” elements: .. container:: row .. container:: col-sm-6 .. image:: theme_tutorial_assets/img/flectra_snippet.jpg .. container:: col-sm-6 Snippets (or building-blocks) A piece of HTML code. The user will drag&drop, modify and combine them using our built-in Website Builder interface. You can define sets of options and styles for each snippet. The user will choose from them according to their needs. .. container:: row .. container:: col-sm-6 Pages These are normal web pages, except that they will be editable by the final user and that you can define an empty area that the user can “fill” by dragging snippets into it. .. container:: col-sm-6 .. image:: theme_tutorial_assets/img/flectra_page.jpg .. container:: row .. figure:: theme_tutorial_assets/img/flectra_styles.jpg :figclass: col-sm-6 Styles Styles are defined using standard CSS files (or Less/Sass). You can define a style as **default** or **optional**. The default styles are always active in your theme, the optional styles can be enabled or disabled by the user. .. figure:: theme_tutorial_assets/img/flectra_functionalities.jpg :figclass: col-sm-6 Functionalities Thanks to Flectra’s modularity, everything can be personalized even more. This means there are endless possibilities for your creativity. Adding functionalities is easy and it’s simple to provide the end user with customizable options. Flectra's XML files, an overview -------------------------------- Any Flectra XML file starts with encoding specifications. After that, you have to write your code inside a ```` tag. .. code-block:: xml [XML]     ## YOUR CODE HERE   Almost every element and option that you create has to be placed inside a ``