Making your own Theme using Multiple Layouts: Difference between revisions


(New page: In some cases, you may require multiple layouts for your custom theme. When would this be applicable? An example would be to facilitate a splash page or a special home page. The best way t...)
 
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
In some cases, you may require multiple layouts for your custom theme. When would this be applicable? An example would be to facilitate a splash page or a special home page. The best way to do this would be to have a separate layout in your theme, and then simply select that layout for your front page. The examples on this page will assume you want to create a separate layout for a splash page.
In some cases, you may require multiple layouts for your custom theme. When would this be applicable? An example would be to facilitate a splash page or a special home page. The best way to do this would be to have a separate layout in your theme, and then simply select that layout for your front page.


When available, our included website themes will have additional layouts. If so, you can use these with your pages in the [[Page Settings]] for an existing page, or in the process of [[Creating a New Page | creating a new page]]. You can edit the code for these layouts in the [[Edit Theme Source Code]] section of the [[Toolbar]]. The naming convention for these files is easy to understand - it uses the name of the file as the name of the layout (single_column shows up as 'Single column') for example.


====How to Create====
We'll use an example below which will assume you want to create a separate layout for a splash page.


Creating another layout is pretty simple. When you unzip a theme into a directory you should have a default.html file which is your theme file. Simply make a copy of this file and call it "splash.html" - then make whatever changes you want to create your front page - a good example might be taking a two column layout and only presenting a single column (location) on the front page.
==Creating Layouts==
 
Creating another layout is pretty simple. When you unzip a theme into a directory you should have a default.html file which is your theme file. As mentioned above, there may be other available layouts for this theme and one of these may be more applicable for your custom layout. Simply make a copy of the file and rename it to whatever you want to call your custom layout. Note that the file must remain an html file, so to create a 'Splash' layout, the filename should be "splash.html".


Make whatever changes you want to your layout following the regular theming guidelines found in the [[Making your own Theme]] area.
Make whatever changes you want to your layout following the regular theming guidelines found in the [[Making your own Theme]] area.


Once you are done, open ''config/theme/xml'' - you will need to add a little bit of configuration to tell Viviti about your new Layout.
==Applying Your Changes==
 
 
Basically, just add this between the <author> tag and before the closing </theme>
 
  <layouts>
  <layout name="splash" label="Splash Page!"></layout>
  </layouts>
 
Of course, this code reflects the second layout being named splash.html - the name part should match the filename (but without the .html). You do not need to tell Viviti about your default (default.html) layout, but you can add as many alternative layouts as you want.
 
 
====How to Use====
 
When ready, just [[Uploading/Downloading a Theme | upload your custom theme]]. The [[Page Settings]] (either when creating a new page, or editing an existing one) will include a new section called "Layout" where you can select "Default" or "Splash".
 
 
====config.xml====
 
For themes with only 1 layout, the config.xml file is not required, however it is necessary if you intend to use multiple layouts or share your theme. The requirements for this file are:
 
* Name
* Author
* Layouts (if applicable)
 
 
An example of the elements required in this file are as follows:
 
 
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
 
<theme>
  <name>Theme Name</name>
  <author url="http://yourwebsite.com">Author Name</author>


  <layouts>
When ready, just [[Uploading/Downloading a Theme | upload your custom theme]]. The [[Page Settings]] (either when creating a new page, or editing an existing one) will include a new section called "Layout" where you can select your custom "Splash" layout.
    <layout name="one" label="Single column"></layout>
  </layouts>
</theme>
</source>




[[Category:Creating Viviti Themes]]
[[Category:Creating Themes]]

Latest revision as of 14:13, 16 November 2010

In some cases, you may require multiple layouts for your custom theme. When would this be applicable? An example would be to facilitate a splash page or a special home page. The best way to do this would be to have a separate layout in your theme, and then simply select that layout for your front page.

When available, our included website themes will have additional layouts. If so, you can use these with your pages in the Page Settings for an existing page, or in the process of creating a new page. You can edit the code for these layouts in the Edit Theme Source Code section of the Toolbar. The naming convention for these files is easy to understand - it uses the name of the file as the name of the layout (single_column shows up as 'Single column') for example.

We'll use an example below which will assume you want to create a separate layout for a splash page.

Creating Layouts

Creating another layout is pretty simple. When you unzip a theme into a directory you should have a default.html file which is your theme file. As mentioned above, there may be other available layouts for this theme and one of these may be more applicable for your custom layout. Simply make a copy of the file and rename it to whatever you want to call your custom layout. Note that the file must remain an html file, so to create a 'Splash' layout, the filename should be "splash.html".

Make whatever changes you want to your layout following the regular theming guidelines found in the Making your own Theme area.

Applying Your Changes

When ready, just upload your custom theme. The Page Settings (either when creating a new page, or editing an existing one) will include a new section called "Layout" where you can select your custom "Splash" layout.