Cyclone3 Skin

Add a new servicetype

From Cyclone3 Wiki

(Difference between revisions)
Current revision (15:25, 25 November 2010) (edit) (undo)
 
(8 intermediate revisions not shown.)
Line 1: Line 1:
-
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 [[How_to:Set_up_type_key|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.
+
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 [[Add a configuration key to servicetype|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:
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:
Line 5: Line 5:
<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!>
<!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
+
then specify the keys, which can acquire values from the FORM variables by default (if not specified otherwise through the administration interface) ([[Add_a_configuration_key_to_servicetype|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="a401_article_cat.ID" description="Article category ID"
-
<CONF_KEY name="a501_image_cat.ID" description="Image category ID" select="a501_article_cat.ID" default="<$main::FORM{'ID_image_category'}>" public="1" />
+
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
+
you can also add security or integrity checks for form values ([[Add_a_form_variable_check_to_servicetype|how?]])
 +
 
 +
<CHECK_FORM variable="ID" type="int" action="destroy" />
 +
 
 +
change the (([[Header|page head]]))
 +
 
 +
<CONF_VAR id="header" value="infopage" />
 +
 
 +
apply page's base layout (([[Body|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 ([[Add_a_link_to_servicetype|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 [[Layer|layers]] you will be using
<CONF_VAR id="layers" value="default" />
<CONF_VAR id="layers" value="default" />
-
and of course, add the modules you will be using
+
and of course, add the [[Module|modules]] you will be using
<MODULE>
<MODULE>
...article view module settings...
...article view module settings...
</MODULE>
</MODULE>
-
 
+
<MODULE>
<MODULE>
...gallery view module settings...
...gallery view module settings...
Line 28: Line 47:
l_{type name}.pub.type
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:
+
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_map = "map"
Line 41: Line 60:
..
..
-
And, that's it. You may start using the type in your links, and/or selecting them from within the sitemap node editor.
+
And, that's it. You may start using the servicetype in your links, and/or selecting them from within the sitemap node editor.
[[Category:HowTo]]
[[Category:HowTo]]
 +
[[Category:Webdesign]]

Current revision

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.