By
Gérard Mendes
- The category in use should be selected (different class CSS)
- The category in use should not be a link if one is on the homepage of the category.
- La catégorie en cours devrait être sélectionnée (classe CSS différente)
- La catégorie en cours ne devrait pas être un lien si on est sur la page d'accueil de la catégorie.
function pxPrimaryCategories
($s =
'<ul>%s</ul>')
{
global $_PX_website_config,
$_PX_config;
$ordermanual =
$GLOBALS['_PX_render']['m']->
getParam('order_cat_manual');
$remove_numbers =
$GLOBALS['_PX_render']['m']->
getParam('remove_numbers');
$order =
'ORDER BY category_path';
if ($ordermanual) {
$order =
'ORDER BY category_name';
}
$rootcat =
$GLOBALS['_PX_render']['m']->
getCategory('/');
$prim =
$GLOBALS['_PX_render']['m']->
getCategories($rootcat->
f('category_id'),
$order);
$isFirst =
true;
$cats =
'';
while (!
$prim->
EOF()) {
//if ($prim->f('category_path') != '/') {
$cat =
'<li class="';
$name =
$prim->
f('category_name');
if ($remove_numbers) {
$name = px_removeNumbers
($name);
}
$path =
$_PX_website_config['rel_url'];
if ($_PX_config['url_format'] ==
'simple') {
$path .=
'/?';
}
if ($GLOBALS['_PX_render']['m']->
cat !=
NULL)
$isCurrent =
$prim->
f('category_path') ==
$GLOBALS['_PX_render']['m']->
cat->
f('category_path');
else
$isCurrent =
false;
$path .=
$prim->
f('category_path');
$cat .=
$isCurrent ?
'current ' :
'';
$cat .=
$isFirst ?
'first' :
'';
$cat .=
'">';
$cat .=
(($isCurrent &&
$GLOBALS['_PX_render']['mode'] !=
'cat') || !
$isCurrent) ?
'<a href="'.
$path.
'">'.
$name.
'</a>' :
$name;
$cats .=
$cat.
'</li>';
//}
$prim->
moveNext();
$isFirst =
false;
}
echo sprintf($s,
$cats);
}
Page was generated in 0.4533 seconds