Separator von Kategorien bei der Meta-Navigation-Ausgabe

Gesperrt
chapuisat
Beiträge: 5
Registriert: Do 30. Okt 2008, 14:41
Kontaktdaten:

Separator von Kategorien bei der Meta-Navigation-Ausgabe

Beitrag von chapuisat »

Hallo,

ich bin leider noch ein PHP Anfänger, aber ich würde gerne innerhalb der Meta Navigation einen Separator zwischen den Links ausgeben, und zwar ein "|". Die Ausgabe soll statt ABC XYZ so sein ABC | XYZ. Es soll aber auch nicht | ABC | XYZ | werden.

Wo innerhalb des Codes des Meta Navigation Moduls müsste also ein solcher Separator reingebaut werden?

Navigation_Meta

Code: Alles auswählen

<?php
// include Contenido_FrontendNavigation class
cInclude('classes', 'Contenido_FrontendNavigation/Contenido_FrontendNavigation.class.php');

// get start idcat
$iIdcatStart = getEffectiveSetting('navigation', 'idcat-meta', 2);

//check if there is a template instance
if (!isset($tpl) || !is_object($tpl)) {
    $tpl = new Template();
}

// reset template object
$tpl->reset();

// build navigation
try {
    $oFeNav = new Contenido_FrontendNavigation($db, $cfg, $client, $lang, $cfgClient);
    $oContenidoCategories = $oFeNav->getSubCategories($iIdcatStart, true);
    if ($oContenidoCategories->count() > 0) {
        foreach ($oContenidoCategories as $oContenidoCategory) {
            $tpl->set('d', 'url', 'front_content.php?idcat='.$oContenidoCategory->getIdCat());
            $tpl->set('d', 'title', $oContenidoCategory->getCategoryLanguage()->getName());
            $tpl->set('d', 'label', $oContenidoCategory->getCategoryLanguage()->getName());
            $tpl->next();
        }
        $sItems = $tpl->generate('templates/navigation_meta_item.html', true, false);
        $tpl->reset();
        $tpl->set('s', 'items', $sItems);
        $tpl->generate('templates/navigation_meta_container.html');
    }
} catch (Exception $e) {
    echo 'Shit happens: ' . $e->getMessage() . ': ' . $e->getFile() . ' at line '.$e->getLine() . ' ('.$e->getTraceAsString().')';
}
?>
navigation_meta_item.html

Code: Alles auswählen

<a href="{url}" title="{title}" class="lang">{label}</a>
navigation_meta_container.html

Code: Alles auswählen

{items}
Danke im Voraus!
media-konzept
Beiträge: 90
Registriert: So 20. Mär 2005, 13:24
Wohnort: CH-5430 Wettingen
Kontaktdaten:

Re: Separator von Kategorien bei der Meta-Navigation-Ausgabe

Beitrag von media-konzept »

Zum Beispiel so:

Code: Alles auswählen

<?php
/**
* $RCSfile$
*
* Description: Meta Navigation on bottom of page
*
* @version 1.0.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2008-04-07
* }}
*
* $Id$
*/

// include Contenido_FrontendNavigation class
cInclude('classes', 'Contenido_FrontendNavigation/Contenido_FrontendNavigation.class.php');

// get start idcat
$iIdcatStart = getEffectiveSetting('navigation', 'idcat-meta', 2);

//check if there is a template instance
if (!isset($tpl) || !is_object($tpl)) {
    $tpl = new Template();
}

// reset template object
$tpl->reset();

// build navigation
try {
    $oFeNav = new Contenido_FrontendNavigation($db, $cfg, $client, $lang, $cfgClient);
    $oContenidoCategories = $oFeNav->getSubCategories($iIdcatStart, true);
    $anzahl = $oContenidoCategories->count();
    if ($anzahl > 0) {
        $count = 0;
        foreach ($oContenidoCategories as $oContenidoCategory) {
            $count++;
            $tpl->set('d', 'url', 'front_content.php?idcat='.$oContenidoCategory->getIdCat());
            $tpl->set('d', 'title', $oContenidoCategory->getCategoryLanguage()->getName());
            $tpl->set('d', 'label', $oContenidoCategory->getCategoryLanguage()->getName());
            if ($anzahl > $count) $tpl->set('d', 'between',' | ');
            else $tpl->set('d', 'between','');
            $tpl->next();
        }
        $sItems = $tpl->generate('templates/navigation_meta_item.html', true, false);
        $tpl->reset();
        $tpl->set('s', 'items', $sItems);
        $tpl->generate('templates/navigation_meta_container.html');
    }
} catch (Exception $e) {
    echo 'Shit happens: ' . $e->getMessage() . ': ' . $e->getFile() . ' at line '.$e->getLine() . ' ('.$e->getTraceAsString().')';
}
?>
und das Modul-Template (item):

Code: Alles auswählen

<!-- BEGIN:BLOCK -->
<a href="{url}" title="{title}">{label}</a>{between}
<!-- END:BLOCK -->
Gruss Walti
two beers or not two beers
chapuisat
Beiträge: 5
Registriert: Do 30. Okt 2008, 14:41
Kontaktdaten:

Re: Separator von Kategorien bei der Meta-Navigation-Ausgabe

Beitrag von chapuisat »

Genial :lol: Schiff versenkt!

Danke und Gruß!
Gesperrt