The balise_NAME_stat() function

If it exists, the balise_NAME_stat() function will make it possible to calculate the arguments to be passed to the following (_dyn()) function. In its absence, only the arguments specified in the calculer_balise_dynamique() function are passed (in the order of the array). The stat function will make it possible to additionally pass the parameters originating from arguments or filters passed to the tag.

The function is passed 2 arguments: $args and $context_compil.

  • $args contains the arguments required by the calculer_balise_dynamique() function, in addition to the arguments passed to the tag.
  • $context_compil is an array of data about the completed compilation, containing 5 entries (template name, compiled file name, the name of the loop where the tag is used, line number, language), possibly followed by optional array elements supplied by the principal function for dynamic tags (the 4th argument of the balise_dynamique function).


Referring again to the #LOGIN_PUBLIC example: it works with either 1 or 2 arguments: the first is the redirection URL after being connected, the second is the default user name for the person to be connected. Both of these are optional.

We can therefore pass a redirection argument to the tag:
#LOGIN_PUBLIC{#SELF} or #LOGIN_PUBLIC{#URL_ARTICLE{8}}, but in the absence of an argument, we would like that the redirection be made to an environment URL parameter if there is one. Once having requested to retrieve this argument, it is found in $args[0]. with $args[1] storing the contents of the first argument passed to the tag (it adds itself into the $args array after the list of arguments automatically retrieved). This ends up with:

function balise_LOGIN_PUBLIC_stat($args, $context_compil) {
	return array(
			? $args[1] 
			: $args[0],
			? $args[2] 
			: '')

If $args[1] exists, it is passed, otherwise $args[0]. In the same manner, if $args[2] exists, it is also passed, otherwise ’’.

The _dyn() function will be passed these 2 arguments:

function balise_LOGIN_PRIVE_dyn($url, $login) {

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français