You are not logged in.

[Tipps & Tricks] Creating a style package

René

Administrator

  • "René" is male
  • "René" started this thread

Posts: 1,590

Location: Berlin

Occupation: KB

  • Send private message

1

Thursday, November 4th 2010, 12:02pm

Creating a style package

Dieser Artikel ist auch auf deutsch verfügbar.


There'll come the time when you as a designer of styles for WBB want to offer a style in some color variations and make the installation of that styles as easy as possible with a single installation.
WBB 3 offers that possibility and not later than WoltLab has released their first style package "BlueSpace" that possibility is well known. In that case styles are not installed via the stlye system but via the plugin API.

But how to create such a style package?
Well, that's really easy. All you need are your different style files, some basic knowledge of XML - don't be afraid, it's really easy - and a tool to create tar balls, for Windows e.g. TUGzip

I think you should have created your style files since I'm not going to show how to do that in this tutorial.
Let's start with the XML file.

Open your favorite Editor (e.g. Notpad - Word is not an editor) and create a new file, save it as package.xml - it has to be exactly that name.

At first you need the basic information like XML Version, Doctype and the package name. It would look like that:

XML

1
2
3
<?xml version="1.0"?>
<!DOCTYPE package SYSTEM "http://www.woltlab.com/DTDs/package.dtd">
<package name="de.d-sign24.wcf.style.Stylename">



Using package name defines the so called package identifier. According to WCF standards you start the identifier is build up with

Source code

1
tld.domain.wcf.style.Stylename


so in my case it would start with de.d-sign24 - as plugins (and a style package is nothing else) have to be unique in WCF you should use something unique even though you may not have a own website.
The part Stylename will be replaced by the name of the style package.

Let's start with the package informations...

XML

1
2
3
4
5
6
7
	<packageinformation>
		<packagename>D-Sign24.de Stylename Style</packagename>
		<version>1.0.0</version>
		<isunique>1</isunique>
		<date>2010-11-04</date>
		<plugin>com.woltlab.wcf.system.style</plugin>
	</packageinformation>


Some curiosity will show up here: when creating the package informations you'll have again packagename - but this time without a space between it - this is where the name of the plugin is stated as it will show up in the ACP.
Using isunique sets if the plugin is unique (1) or not (0), meaning if you can install only 1 instance of a plugin or more - WCF plugins have to be unique.
With plugin you define where your package will plug-in - in that case we'll plug the style system of WCF.

Now we'll need the author's information, meaning name and website. You'll define it that way:

XML

1
2
3
4
	<authorinformation>
		<author>Rene Leege</author>
		<authorurl>http://www.d-sign24.de</authorurl>
	</authorinformation>


As you see I chose not to use special characters in my name - you should do the same to avoid problems ;)

Now it's time to define which plugins/package/applications are required for the installation of our plugin. You'll declare it by using the accordant package identifier. We'll need at least WCF in Version 1.1.0 and the style system - Version 1.1.0 as well.

XML

1
2
3
4
<requiredpackages>
		<requiredpackage minversion="1.1.0">com.woltlab.wcf</requiredpackage>
		<requiredpackage minversion="1.1.0">com.woltlab.wcf.system.style</requiredpackage>
	</requiredpackages>

Ok, we're almost done, but we still didn't install the styles. We'll do that by telling the WCF what to install. It's nothing more than - according to the doctype - telling the names of the style files using the complete filename!

XML

1
2
3
4
5
	<instructions type="install">
		<style>d-sign24.de-stilname-blue-style.tgz</style>
		<style>d-sign24.de-stilname-green-style.tgz</style>
		<style>d-sign24.de-stilname-red-style.tgz</style>
	</instructions>


The last part: we'll have to make the XML file valid by closing the first tag:

XML

1
</package>


Now you can save the file and close it.

Put the package.xml in the same directory you have put your style files in. Make sure that the style's file names are exactly the same as those in your package.xml and make sure that nothing's missing. Mark your style files and the package.xml and create a tar ball.
If you're using TUGzip choose "Create archive" from the context menu (right click) and then choose tar.

That's it - you don't need anything more the plugin is ready to be installed in WCF 1.1 with an existent style system.
Kein Support via PN, E-Mail oder Messenger.

Social bookmarks