Cyclone3 Skin

Add a new servicetype

From Cyclone3 Wiki

(Difference between revisions)
Line 46: Line 46:

Revision as of 17:09, 7 May 2009

If you need to create a new service type, try to think if it's really needed. Some of the required functionality may be solved by setting up a type key, i.e. changing the article output template for an article view type, by setting an article_xsgn key. This way, you can specify the article template manually, or leave it fall back to the default template otherwise.

But let's get back to the point. Let's say you need a type which will display an article and an image gallery - open your editor and start with:

<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!>

then specify the keys, which will acquire values from the FORM variables by default (if not specified otherwise through the administration interface

<CONF_KEY name="a401_article_cat.ID" description="Article category ID"
 select="a401_article_cat.ID" default="<$main::FORM{'ID_article'}>" public="1" />
<CONF_KEY name="a501_image_cat.ID" description="Image category ID"
 select="a501_article_cat.ID" default="<$main::FORM{'ID_image_category'}>" public="1" />

optionally, some layers you will be using

<CONF_VAR id="layers" value="default" />

and of course, add the modules you will be using

...article view module settings...
<MODULE> view module settings...

now ... save it into the _type subfolder of your service's root directory, under a unique name in the following syntax, in ASCII format (without national characters):

l_{type name}.pub.type

Almost there, but there's one thing more. You need to REGISTER new service type to the type configuration file. You will find it in the domain's root folder, under the name type.conf. Open it, and add a new line:

l_map = "map"
l_article = "article"
l_article-news = "article-news"
l_{type name} = "{type name}"

It is wise to keep this file organized, by grouping related type definitions - article types, image types, a.s.o. The left side specifies a type file name, right side specifies its caller name. You will be using the caller name in the internal links, i.e.:

<a href="?|?type={type name}&ID_article=345&ID_image_category=34">My holiday</a>

And, that's it. You may start using the type in your links, and/or selecting them from within the sitemap node editor.