Importing and exporting page types

This article explains how to export a pagetype and import it to a different Litium project. The typical usage is that, you develop a pagetype that can be re-used in other projects.

Exporting the page type

The page type has following three components that need to be exported (in order to later import to another project).

  1. Pagetype
  2. Website strings used by templates (translations in different languages)
  3. Template files

Step 1: Export the page type from backoffice

Go to Settings > Sites > Page types and templates.

Exportpagetype.png

An XML file will be generated which contains the page type name, its settings, template paths and language translations of field definition names used. Note that the templates may use website string, and these strings need to be exported seperately as described below.

If your page type is configured only for specific websites, the exported xml file will contain these website names, which is not desirable in most cases because the importing project may not use the same website names. To avoid any conflicts edit the file in Notepad and change the WebSites attribute to '*' as shown below.

pagetype websites.png

Similarly, in the same file, you will find the WebSites attribute for each template. These should also be changed to a '*'. This makes all templates and this pagetype to be usable for all websites.

pagetype websites2.png

Step 2: Create website string definitions

The page templates may use website strings, which have translations in different languages. A website strings file for each language should be created with all these texts (to be imported back later to the target project).

If translations are in three languages, then there will be three files with identical format but different translated values depending on the language to which the file is created.

This file should be an XML file and should have the following format., following example shows the way file will look in English.

<WebSiteStringCollection>
  <Strings>
    <WebSiteString Key="CheckOutVAT" Value="VAT" />
    <WebSiteString Key="CheckOutZip" Value="Zip" />
    ...
    ...
  </Strings>
</WebSiteStringCollection>

The same file for Swedish may look like (note VAT is translated as Moms)

<WebSiteStringCollection>
  <Strings>
    <WebSiteString Key="CheckOutVAT" Value="Moms" />
    <WebSiteString Key="CheckOutZip" Value="Zip" />
    ...
    ...
  </Strings>
</WebSiteStringCollection>

The WebSiteString Key are the website string keys used in the page templates. Usually they are used from the web:WebSiteString webcontrol as shown below for CheckoutZip key above.

website string.png

Step 3: Template files

The physical template files need to be saved (to a folder that can be zipped and taken to the target project), and should be in the same folder structure. They have to be placed in the exact same location relative to the web root folder, because the XML file created in step 1 contains these paths.

Also, any web user controls used by these templates should also be saved. Following image shows the created folder structure when importing a sample checkout page.

checkout pagetype.png

Step 4: Styles and css

The page type and templates may use specific styles and css classes. If this is the case they also need to be saved so that it can be merged to the target project.

Importing the Page type

To import the page type follow the steps below.

  1. Copy over the folder prepared in step 3 (of export) to the target project web root. This will place all the templates, web controls and images.
  2. Go to Settings > Sites > Page types and templates and click Import button from the menu bar and point to the file prepared in Step 1 (of export) above.
  3. Go to the website (Settings > Sites > Web sites and Texts) that uses this page type and import the wesbite strings prepared in step 2 (of export) above.
  4. Merge or import any css classes and styles used by the page type and templates.

Websites the page type and templates can be used in

If you do not wish to have the page type or templates for a specific site, you need to edit the pagetype and select the correct sites.

Is this page helpful?
Thank you for your feedback!