|
Page 1 of 5 This section is dedicated to the registered members, that wish to use their own "self-made" modules in their personal space or wish propose them to all the members of the community. In order to create a module and to add, you need a basic programming languages knowledge and you have to follow syntax rules indicated in this section. Gizj reserves the right not to publish modules that have content or syntax not consistent to the terms of use, or that they do not respect the laws on the protection of trademarks and copyrights. Your modules in waiting of approval state and approved appear in the section "Your modules" accessible from the menu main of your personal space. Clicking two times on a approved module you can use it on your page. The same module can be contemporally published on multiple pages of your space. You can add two different kind of modules: 1) content modules with the standard. In order to add interesting content to the community it is necessary to login and to click on "Your modules" link in the main menu on the top left of the page. The following option will appear to you: Add an existing RSS feed Add a RSS feed in the module directory
In the following page you have to type the URL of the content that you want to add: Add RSS feed in the modules directory Step 1 : RSS feed URL
RSS feed URL
and click on the "Continue>>>" button. 2) ad hoc self-made modules. Gizj uses a standard structure of the modules, that it respects the rules of many similar services. Here follow some simple instructions in order to create your modules. Summary - Module's properties: title, description and module's height
- Module's options: personalization options given to module's users
- Module's content:
- Module's type
- Module's HTML content
- Module's javaScript content
- Translation / internationalization
- Templates
- Samples
- Test your module
Your module is an XML file: <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="module name" description="module description" height="200" /> <UserPref name="variable1" datatype="enum" default_value="value1" display_name="variable n.1 :" > <EnumValue value="value1" display_value="value n.1" /> <EnumValue value="value2" display_value="value n.2" /> <EnumValue value="value3" display_value="value n.3" /> <EnumValue value="value4" display_value="value n.4" /> <EnumValue value="value5" display_value="value n.5" /> </UserPref> <Content type="html"><![CDATA[ module HTML content <script type="text/javascript"> module javaScript content </script> ]]> </Content> </Module> The document is based on 3 parts, that we will explain below : - Module's properties (ModulePrefs tag)
- Module's options (UserPref tag)
- Module's content (Content tag)
Module's propertiesThe ModulePrefs tag is used to define the properties of the module:
<ModulePrefs title="my module" description="it is my module" height="200" /> - title: module's name (required). String (30 car. max.).
- description: module's description (optional). String (250 car. max.).
- height: module's pixels height (required). Integer between 20 and 400. If the module content height is changing, you will use the _IG_AdjustIFrameHeight function in the module javaScript content.
Module's optionsThe UserPref tags are used to define the module's options, that will give personalization to users. These are the options that show up when you click on "configure" button on module's header.
<UserPref name="variable1" datatype="enum" default_value="value1" display_name="variable n.1 :" > - name: option's ID. String without whitespaces.
- datatype: option's type
The option type can be : - string
<UserPref name="name" datatype="string" default_value="Will Smith" display_name="Your name :" > - password: string, all characters are replaced by * to hide the value
<UserPref name="password" datatype="password" default_value="" display_name="Password :" > - bool: check box. The default_value can be "true"(checked) or "false"(unchecked)
<UserPref name="thumb" datatype="bool" default_value="true" display_name="Show the thumbnails ?" /> - enum: Select box. Each select element will be define by an "EnumValue" tag.
<UserPref name="color" datatype="enum" default_value="blue" display_name="background color :"> <EnumValue value="red" display_value="Red" /> <EnumValue value="blue" display_value="Blue" /> <EnumValue value="green" display_value="Green" /> <EnumValue value="yellow" display_value="Yellow" /> </UserPref> - default_value:default option value (used on first module display for a user).
- display_name: label displayed.
Module's contentThe Content tag define the module's type, the HTML and javaScript code of the module.
<Content type="html"><![CDATA[ <div id="examplediv"></div> <script type="text/javascript"> function init(){ var div=_gel("examplediv"); div.innerHTML="Hello World !"; } _IG_RegisterOnloadHandler(init); </script> ]]> </Content> - "type" attribute define the module's type :
- type="html": module stored on our servers. If you have the choice, always use this type.
<Content type="html"><![CDATA[ <div id="examplediv"></div> <script type="text/javascript"> function init(){ var div=_gel("examplediv"); div.innerHTML="Hello World !"; } _IG_RegisterOnloadHandler(init); </script> ]]> </Content> - type="URL": module stored on your servers. You can use this type if your module's content is dynamic (refreshed on each display with you database information) and if you can not use the _IG_FetchContent and _IG_FetchXmlContent functions.
<Content type="url" href="http://www.mywebsite.com/mymodule.php" /> For this type of module, the tag is empty because your module's code is in the file specified by the URL attribute.
Attention : If you need to use the javascript functions mentionned below and our CSS file, insert the following rows in the tag of your module: <link rel="stylesheet" type="text/css" media="screen" title="default" href="http://www.gizj.com/styles/module.css" /> <script type="text/javascript" src="http://www.gizj.com/includes/modules.js"></script>
The module's HTML (except for URL type) Type the HTML of your module. It will be formatted by our CSS
The javaScript code of your module (except for URL type)- In a unique tag <script type="text/javascript"></script>, type the javaScript of your module.
You can use the following functions:
Code functions | | _IG_RegisterOnloadHandler(FUNCTION) | Call the FUNCTION function on the module loading. example : function init(){ alert('hello world'); } _IG_RegisterOnloadHandler(init); | | _IG_AdjustIFrameHeight() | Adjust the module height to the module content. Use it if the module's height change. | | _IG_FetchContent(URL, FUNCTION) | Load the content of a file defined by its URL and send the results to the FUNCTION function. Using of asynchronous Ajax. Example : function treatFile(responsetxt){ var obj=_gel("mydiv"); obj.innerHTML=responsetxt; } _IG_FetchContent('http://www.mysite.com/mydoc.csv',treatFile); | | _IG_FetchXmlContent(URL, FUNCTION) | Load the content of an XML file defined by its URL and send the results to the FUNCTION function. Using of asynchronous Ajax. Example : function treatXml(responsexml){ var str="name : "+responsexml.getElementByTagName("name").firstChild.nodeValue+" age : "+responsexml.getElementByTagName("age").firstChild.nodeValue; var obj=_gel("mydiv"); obj.innerHTML=str; } _IG_FetchXmlContent('http://www.mysite.com/myxmlfile.xml',treatXml); |
<< Start < Prev 1 2 3 4 5 Next > End >> |