SPIP

[ar] [ast] [bg] [br] [ca] [co] [cpf] [cs] [da] [de] [en] [eo] [es] [eu] [fa] [fon] [fr] [gl] [id] [it] [ja] [lb] [nl] [oc] [pl] [pt] [ro] [ru] [sk] [sv] [tr] [uk] [vi] [zh] Espace de traduction

Download
Home > English documentation > Webmasters > Page layout: reference manual of loops and tags > Using the private space CVT forms on public-facing pages

Using the private space CVT forms on public-facing pages

December 2010

All the versions of this article:


For CVT forms employed in SPIP’s private space can also be used in public-facing templates [1]. These forms allow you to create or modify site elements such as articles, sections, etc.

These forms are constructed based on the files made available in the prive/formulaires/ directory, where, for each of the forms, there are a pair of files of the type: editer_article.html ; editer_article.php.

For further information on how these tags work, please reader the article The CVT forms of SPIP 2.0.

#FORMULAIRE_EDITER_ARTICLE

#FORMULAIRE_EDITER_ARTICLE{id_article, id_rubrique, retour, lier_trad}

Parameters of the tag:

  • id_article specifies the identifier of the article to be modified. If it equals "oui" (yes), then the form will create a new article.
  • id_rubrique specifies the identifier of the section containing the article to be edited.
  • retour is used to define the URL to which the user will be redirected once the form has been validated.
  • lier_trad is used to indicate that the article created is a translation of the article passed in the context.

#FORMULAIRE_EDITER_AUTEUR

#FORMULAIRE_EDITER_AUTEUR{id_auteur, retour, lier_id_article}

Parameters of the tag:

  • id_auteur specifies the identifier of the author to be modified. If it equals "oui" (yes), then the form will create a new author.
  • retour is used to define the URL to which the user will be redirected once the form has been validated.
  • lier_id_article is used to attach the author to an article when it is created.

#FORMULAIRE_EDITER_BREVE

#FORMULAIRE_EDITER_BREVE{id_breve, id_rubrique, retour, lier_trad}

Parameters of the tag:

  • id_breve specifies the identifier of the news item to be modified. If it equals "oui" (yes), then the form will create a new news item.
  • id_rubrique specifies the identifier of the section containing the news item to be edited.
  • retour is used to define the URL to which the user will be redirected once the form has been validated.
  • lier_trad is used to indicate that the news item created is a translation of the news item passed in the context.

#FORMULAIRE_EDITER_GROUPE_MOT

#FORMULAIRE_EDITER_GROUPE_MOT{id_groupe, retour}

Parameters of the tag:

  • id_groupe specifies the identifier of the keywords group to be modified. If it equals "oui" (yes), then the form will create a new group.
  • retour is used to define the URL to which the user will be redirected once the form has been validated.

#FORMULAIRE_EDITER_MOT

#FORMULAIRE_EDITER_MOT{id_mot, id_groupe, retour,  ajouter_id_article, table, table_id}

Parameters of the tag:

  • id_mot specifies the identifier of the keyword to be modified. If it equals "oui" (yes), then the form will create a new keyword.
  • id_groupe specifies the identifier of the group that contains the keyword to be edited.
  • retour is used to define the URL to which the user will be redirected once the form has been validated.
  • ajouter_id_article is used to attach the keyword to an object when it is created.
  • table is used to specify the type of object to which the keyword is linked when it is created (e.g. "articles" for an article).
  • table_id is used to specify the name of the field representing the id of the object to which the keyword is linked when it is created (e.e. "id_article" for an article).

#FORMULAIRE_EDITER_RUBRIQUE

#FORMULAIRE_EDITER_RUBRIQUE{id_rubrique, id_parent, retour, lier_trad}

Parameters of the tag:

  • id_rubrique specifies the identifier of the section to be modified. If it equals "oui" (yes), then the form will create a new section.
  • id_parent specifies the identifier of the section containing the section to be edited.
  • retour is used to define the URL to which the user will be redirected once the form has been validated.
  • lier_trad is used to indicate that the section created is a translation of the section passed in the context.

For example, to create a new section from a given current section page:

[(#FORMULAIRE_EDITER_RUBRIQUE{oui, #ID_RUBRIQUE, [(#SELF|parametre_url{id_rubrique, #ID_RUBRIQUE})]})]

#FORMULAIRE_EDITER_SITE

#FORMULAIRE_EDITER_SITE{id_syndic, id_rubrique, retour, lier_trad}

Parameters of the tag:

  • id_syndic specifies the identifier of the site to be modified. If it equals "oui" (yes), then the form will create a new site.
  • id_rubrique specifies the identifier of the section containing the site to be edited.
  • retour is used to define the URL to which the user will be redirected once the form has been validated.
  • lier_trad is used to indicate that the section created is a translation of the site passed in the context.

Restricting the display of the forms

If the actions called during the processing of the form are secured using mechanisms internal to SPIP, it is important to note that these forms are accessible to everyone as soon as you insert them into a public-facing template.

To restrict the display of a form in a template, you can either use the #AUTORISER or #SESSION tags.

For example, to display an article creation form only to site administrators, you could use:

[(#SESSION{statut}|=={0minirezo}|oui)
#FORMULAIRE_EDITER_ARTICLE{oui, #ID_RUBRIQUE}
]

Footnotes

[1It is therefore possible to "overload" these forms by modifying a copy that is to be carefully stored in a directory named squelettes/formulaires/
Warning: any such forms that are modified/overloaded will from now on be used in the private space too where they will replace the SPIP originals.


Show the template of this page Site powered by SPIP | Translation area | Private area