udm_cat_path

(PHP 4 >= 4.0.6)

udm_cat_path -- Lit le chemin de la catégorie courante.

Description

array udm_cat_path (int agent, string category)

udm_cat_path() retourne un tableau listant les catégories depuis la racine jusqu'à la catégorie courante.

Le paramètre agent est un identifiant de résultat, obtenu après un appel à Udm_Alloc_Agent.

category - La catégorie courante : celle dont on veut le chemin.

udm_cat_path() retourne un tableau avec le format suivant :

Le tableau est constitué de paires. Les index pairs contiennent les chemins de catégories, les index impairs contiennent les noms des catégories correspondantes.

Par exemple, l'appel $array=udm_cat_path($agent, '02031D'); peut retourner le tableau suivant :


 $array[0] contiendra ''
 $array[1] contiendra 'Root'
 $array[2] contiendra '02'
 $array[3] contiendra 'Sport'
 $array[4] contiendra '0203'
 $array[5] contiendra 'Foot'
 $array[4] contiendra '02031D'
 $array[5] contiendra 'PSG'
   

Exemple 1. Spécifier le chemin de la catégorie courante avec le format suivant : '> Root > Sport > Foot > PSG'

<?php
  $cat_path_arr=Udm_Cat_Path($udm_agent,$cat);
  $cat_path='';
  for ($i=0; $i<count($cat_path_arr); $i+=2) {
    $path=$cat_path_arr[$i];
    $name=$cat_path_arr[$i+1];
    $cat_path .= " > <a href=\"$PHP_SELF?cat=$path\">$name</a> ";
  }
>