Actions

Distributing Joomla! templates

From Joomla! Documentation

If you want to distribute your extension, you will need to choose a license carefully. Read Extensions and GPL for more information.

If you want to publish your extension on the Joomla Extensions Directory, you will need to make sure your license is compatible. Make sure you've read the JED Entries License Checklist before choosing a license.


Contents

How does template installation work?

It is important to understand how template installation works.


Install via Admin Panel (packed template file)

Log into the back-end of your site (www.your-site.com/administrator/)

Click on: Extensions -> Extension Manager

30-Installing-template-navigate.png

You see the page "Extension Manager"

From here you can install your Templates, Plugins, Modules, Components and Languages. You have three options:

  1. Upload Package File - (select a package from your PC, upload and install it)
  2. Install from Directory - (enter the path where the package is located on your webserver)
  3. Install from URL - (enter the URL to the package)

Option 3 does everything for you, your environment needs to be properly configured to allow this. Option 1 requires you to download the extension to your PC. Option 2 requires you to unzip and move the folders/files to your webserver. All option require the webserver to have write access to the webspace.

Here, we choose the first method: Upload Package File

Select the package from your PC and click the button "Upload File & Install"

30-Installing-template-upload-package-file.png


If the package contains no errors you are done and get a success message like the one below.

30-Installing-template-install-success.png

Verify installation

Go from Install to Manage, set the type filter to 'template'. The installed template should appear in the list. If it does, the template is properly installed. Now you can assign one of styles to a menuitem or set the style as default.
For administrator templates make sure you have two windows of the template manager. Activate the new template in one of them and reset it in the other one if something went wrong.

Install via FTP (unpacked template file)

Templates can also be installed via FTP without packaging them. Simply select the template folder on your PC and upload it to your server, using your favorite FTP software. Be sure you upload the template folder to the directory: /path_to_joomla/templates/ - where /path_to_joomla/ is the location of your Joomla! installation on the server. This method is mostly used when you have created a template yourself, and do not want to have to package it to install the template, or if you want to upload more than one template at once. You must then go into extension manager and click on Discover in the sub menu. Click on "Discover" in the toolbar if your template doesn't immediately appear. A list of uninstalled items in the FTP should then appear. Click the checkbox to the left of your template and click install.

Note: Do not try to use FTP to install Components, Modules and Plugins if you are a beginner/novice. These items need database entries which have to be inserted manually if you bypass the package installer.

Install Content From A Template [Advanced Topic]

30-Import content from template.png

Joomla Version 3.0 and above can import content along with templates. This is a means to develop content locally with programs like Artisteer so you can import your whole site in one go. To import your content; Install the template as above, then from the Template Manager: Styles page (Extension > Template Manager) Select your template name in the left hand column (with the heading style), Click the Options tab and find 'Import Content from Template' Button. Click the import button which will activate a pop up modal window then click import or cancel.



File structure for packaging

The most basic files, such as index.php, component.php, templateDetails.xml, template_thumbnail.png, favicon.ico, params.ini should be placed directly in your template folder. The most common is to place images, CSS files, JavaScript files etc in separate folders. Joomla override files must be placed in folders in the folder "html".

When making the template folder, your language files should be copied to your template folder. The ones for the front end site should be placed directly in the template folder. If you have language files for the back end, these should be placed in a folder, named for instance "admin". All the language files will be copied automatically to the right folders if stated correctly in the templateDetails.xml.

Creating a thumbnail preview image

A thumbnail preview image should be 206 pixels in width and 150 pixels high. Recommended file format is png.

You can take a screen shot of your site/template using the key "Prnt Scrn" on Windows or the corresponding on Mac/Linux. (There are also many programs specialized in screen shots that can be used.) After making the screen shot, paste or open the picture in an image editor such as PhotoShop or Gimp and resize and crop your image to 206x150 pixles.

Packaging the template for installation

A directory with several loose files is not a convenient package for distribution. So the final step is to make a package. This is a compressed archive containing the directory structure and all the files. The package can be in ZIP format (with a .zip extension), in TAR-gzip format (with a .tar.gz extension), or in TAR-bz2 format (with a .tar.bz2 extension).

If your template is in a directory mytemplate/ then to make the package you can connect to that directory and use commands like:

  • tar cvvzf ../mytemplate.tar.gz *
  • zip -a -r ..\mytemplate.zip *.*

Note to Mac OS X users

Note to template developers using Mac OS X systems: the Finder's "compress" menu item produces a usable ZIP format package, but with one catch. It stores the files in AppleDouble format, adding extra files with names beginning with "._". Thus it adds a file named "._templateDetails.xml, which Joomla 1.5.x can sometimes misinterpret. The symptom is an error message, "XML Parsing Error at 1:1. Error 4: Empty document". The workaround is to compress from the command line, and set a shell environment variable "COPYFILE_DISABLE" to "true" before using "compress" or "tar". See the AppleDouble article for more information.

To set an environment variable on a Mac, open a terminal window and type:

export COPYFILE_DISABLE=true

Then in the same terminal window, change directories into where your template files reside and issue the zip command. For instance, if your template files have been built in a folder in your personal directory called myTemplate, then you would do the following:

cd myTemplate
zip -r myTemplate.zip *