en fr
acs.geomaticien.org
En construction - Under constructionLogiciel libre de création de sites web
en fr

Component


An ACS component is a page or a part of a spip page skeleton you can configure by your website interface, without editing any file.

GIF - 28.8 kb
Composant Fond

Webmaster, web-designer

Webmaster or web-designer configure appearence and working mode of the website by setting ACS and ACS choosen components from private area Configuration menu, submenu Configure website.

First, configure general options for all the site (by configuring Fond component, in Cat model), choose which optionnal components to activate, and then insert its in container components like Entete, Col1, or Col3, which respectively define optionnals components inserted as page header, column one, or column three of Cat model, a three-columns model.

Developpers

A component is an object, in programming terms, that comply with:
- encapsulation: all about one component is in its component directory.
- polymorphism: property names are unified for all components; appearance and functiunalities of one component can vary upon context or container; etc.
- inheritage: a component can inherit some properties from another component.

On the public site, a component is a simple piece of Spip skeleton. On the private area, it is an object with web-configurable properties.

Insert an ACS component in a Spip skeleton

All active ACS model components can be included to Spip skeletons pages with the Spip tag <INCLURE> :
<INCLUREfond=composants/<component>/<sub-component>>

Components allows parameters:

<INCLUREfond=composants/<component>/<sub-component>self=#SELFother parameter(s)>

In these sample, passing #SELF enable Spip to distinguish caching rules. These astuce suits to get isolated Spip cache for "Ajaxified" components in Ajax mode, different from its container’s Spip cache.

Create or modify ACS component

Create a skeleton directory with a composants sub-directory, or directly create your customized composants sub-directory in your existing skeleton directory,, and copy/paste one or more components from an existing ACS model directory (/composants). Do not forget to create a composants/config.php file with your personnal list of available components.
Declare your skeleton’s directory in ACS (Administration pane), and your customized components will be automatically included instead of same-named components from the active ACS model.
Your skeletons may use components from the active ACS model, components inherited from these active ACS model modified by your own, and yours genuine new components.

Only one file is really mandatory to define a component, the composants/<composant>/ecrire/composant.xml file.

Component directories and filel:

- composants/composant : root

- composants/composant/composant.html : component skeleton
- composants/composant/composant.css.html : component stylesheet
- composants/composant/lang/ : component lang files (public area)
- composants/composant/composant.php : Optionnal class definition to implement pre-defined methods (like insert_head) for the component.
- composants/composant/composant_balises.php : Optionnal component’s Spip tags

- composants/composant/ecrire/ : elements for private area
- composants/composant/ecrire/composant.xml : component definition
- composants/composant/ecrire/lang/ : component lang files for private area
- composants/composant/ecrire/composant.php : Optionnal class definition définition optionnelle d’une classe to implement pre-defined methods (like afterUpdate) for the component.

- composants/composant/img_pack/ : images and icon of the component.

composant.xml file

The component "C" is define by its composant.xml file (directory composants/C of active skeleton). Component’s characteristics, parameters, and variables are defined in this file. Its syntax is copied from plugin.xml files in Spip.

- nom: component name (canonical name in the developper’s choosen language, preferentially between french, english, or esperanto)
- auteur: component’s authors
- version: component version
- version_acs_min: minimal ACS version.
- version_acs_max: version max for ACS.
- version_spip_min: minimal Spip version.
- version_spip_max: version max of Spip.

param:
- optionnel: true (nothing= false, by default),
or meta variable name (activation if variable value is "oui"),
or plugin plugin_name (activation if plugin plugin_name is active)
- preview: true (nothing= false, by default). Preview height if numeric.

variable:
- nom: variable name
- type: type of variable: img, color, textarea, widget ...
- valeur: default value. Can be an ACS variable name: in this case, default value is the ACS variable value.
- chemin: "variable path". Default path for image type variable. Relative path from $GLOBALS[’ACS_CHEMIN’] (accessible by tag #ACS_CHEMINmydir/myimage.png from a skeleton).
- label: "non" to not display a label for this variable.

Variables types ACS controls
Color color choice
Img image choice, upload
LargeurBord Border width choice
StyleBord Border style choice
Nombre Number input
Text Short text input (text input)
Textarea Long text input (textarea)
Choix Choice
Widget Components choice (container)
Hidden hidden input

Example:

<composant>
 <!-- Component name -->
 <nom>MyComponent</nom>
 <!-- Author -->
 <auteur>We &copy; 2008 - licence GPL</auteur>
 <version>0.3</version>
 <version_acs_min>0.3</version_acs_min>
 <version_acs_max>0.3</version_acs_max>
 <version_spip_min>1.9207</version_spip_min>
 <version_spip_max>1.9208</version_spip_max>

 <param>
   <nom>optionnel</nom>
   <valeur>true</valeur>
 </param>

 <variable>
   <nom>Color</nom>
   <type>color</type>
 </variable>
</composant>

Component MyComponent define a color. These color is now usable everywhere in skeletons, as variable #CONFIGacsMyComponentColor (usually, a color will be used in the component’s stylesheet (composants/mycomponent/mycomponent.css.html).

Lu par 59783 personnes depuis le Friday 11 July 2008

Any message or comment?

pre-moderation

This forum is moderated beforehand: your contribution will only appear after being validated by a site administrator.

Any message or comment?
  • (To create paragraphs, you simply leave blank lines.)

Who are you? (optional)

ACS, c’est l’Assistant de Configuration du Site.
67 textes de 6 auteur-e-s lus 433118 fois par 340239 personnes.