The balise_NAME_dist function

The first function for a dynamic tag is the same function used for static tags, that is, a function with that tag’s actual name: balise_NAME_dist().

This function, instead of inserting a static code, will call a function generating a dynamic code: calculer_balise_dynamique().

Generally speaking, the contents of the function contine with calling the dynamic calculation, as with this following tag example for #LOGIN_PRIVE :

function balise_LOGIN_PRIVE ($p) {
	return calculer_balise_dynamique($p, 'LOGIN_PRIVE', array('url'));

The tag function is passed the $p variable containing the data originating from the analysis of the template in question (arguments, filters, to which loop it belongs, etc.).

The calculer_balise_dynamique function accepts 3 or 4 arguments:

  • the $p description
  • the name of the dynamic tag to execute (normally the same name as the tag!)
  • an array of arguments to be retrieved from the page context. At this point, the dynamic tag requests the retrieval of a url parameter originating from the context (the closest loop or the template compilation environment). If there is no parameter to be retrieved from the context, then it must be passed an empty array().
  • the optional 4th argument is used to pass an array of elements that will be passed to the following function (balise_NOM_stat), thereby completing the $context_compil array. This then allows the calculation of the elements in the balise_NOM_dist() function and to pass them on.

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

Translations : English, français, Nederlands