Cyclone3 Skin

Add a new servicetype

From Cyclone3 Wiki

Revision as of 15:22, 25 November 2010 by 86.110.227.49 (Talk)

If you need to create a new servicetype, try to think if it's really needed. Some of the required functionality may be solved by setting up a servicetype key, i.e. changing the article output template for an article view servicetype, 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 can acquire values from the FORM variables by default (if not specified otherwise through the administration interface) (how?)

<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" />

you can also add security or integrity checks for form values (how?)

<CHECK_FORM variable="ID" type="int" action="destroy" />

change the ((page head))

<CONF_VAR id="header" value="infopage" />

apply page's base layout ((body)) with module output destinations (if you are using a page head CONF_VAR, it MUST precede the body CONF_VAR, otherwise loading of the defined body will be discarded)

<CONF_VAR id="body" value="infopage" />

add servicetype relevant links like stylesheets or RSS resources (how?)

<CONF_VAR id="link" rel="alternate" title="Article styles" href="/media/article.screen.css" type="text/css" />
<CONF_VAR id="link" rel="alternate" title="Mypage RSS" href="http://www.mypage.com/xml/news.rss" type="application/rss+xml" />

optionally, some layers you will be using

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

and of course, add the modules you will be using

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

<MODULE>
...gallery view module settings...
</MODULE>

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 servicetype to the servicetype 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 servicetype in your links, and/or selecting them from within the sitemap node editor.