Hauptnavigations-Modul: Format für Hyperlinks ändern?

Gesperrt
-Ben-
Beiträge: 2
Registriert: Di 29. Mär 2005, 13:45
Kontaktdaten:

Hauptnavigations-Modul: Format für Hyperlinks ändern?

Beitrag von -Ben- »

Hallo Community,

ich möchte gerne die Darstellungsart der im Hauptnavigations-Modul (welches standardmäßig in der 4.4.5 dabei ist) enthaltenen Hyperlinks ändern, habe aber keine Ahnung, wie ich das anstellen soll. Die Formatierung der normalen Links im Fließtext soll so bleiben wie bisher. Ich nehme mal an, dass ich dazu den Styleeditor verwenden und die format.css bearbeiten muss. Dort ist ja die Darstellung von Links deklariert und ich habe für die Hauptnavi-Links auch schon eine eigene Klasse erstellt:

Code: Alles auswählen

A.hauptnav:link	{font-family: helvetica, arial, geneva, sans-serif; font-size:13; text-decoration: none; color: #000000}
A.hauptnav:visited {font-family: helvetica, arial, geneva, sans-serif; font-size:13; text-decoration: none; color: #000000}
A.hauptnav:hover	{font-family: helvetica, arial, geneva, sans-serif; font-size:13; text-decoration: underline; color: #000000}
A.hauptnav:active	{font-family: helvetica, arial, geneva, sans-serif; font-size:13; text-decoration: none; color: #000000}
Mein Problem ist jetzt nur, dass ich nicht weiss, wo im Input- oder Output-Code des Hauptnavigations-Moduls ich den Befehl class="hauptnav" setzen muss, damit die neue Formatierung übernommen wird. Oder funktioniert das ganz anders? Hier jedenfalls mal der Code:

INPUT

Code: Alles auswählen

?>
<table cellspacing="0" cellpadding="0" cellpadding="0">
    <tr>
        <td class="text_medium" style="padding: 10px;">Baum waehlen:</td>
        <td style="padding: 10px;">
            <select name="CMS_VAR[0]">
            <option value="0">-- kein --</option>
            <?php

                $sql = "SELECT
                            A.idcat,
                            C.name
                        FROM
                            ".$cfg["tab"]["cat_tree"]." AS A,
                            ".$cfg["tab"]["cat"]." AS B,
                            ".$cfg["tab"]["cat_lang"]." AS C
                        WHERE
                            A.idcat     = B.idcat AND
                            B.idcat     = C.idcat AND
                            C.idlang    = '".$lang."' AND
                            B.idclient  = '".$client."' AND
                            C.visible   = 1 AND
                            A.level     = '0'
                        ORDER BY
                            A.idtree";

                $db->query($sql);

                while ( $db->next_record() ) {

                    if ( "CMS_VALUE[0]" == $db->f("idcat") ) {
                        echo '<option selected="selected" value="'.$db->f("idcat").'">'.$db->f("name").'</option>';

                    } else {
                        echo '<option value="'.$db->f("idcat").'">'.$db->f("name").'</option>';

                    }
                }

            ?>
            </select>
        </td>
    </tr>
</table>

<?php

OUTPUT

Code: Alles auswählen

<?php

/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname   :     Navigation 1.1
* Author      :     Jan Lengowski
* Copyright   :     Contenido - four for business
* Created     :     15-05-2003
* Modified    :     26-05-2003
************************************************/

if ( !is_object($db2) ) {
    $db2 = new DB_Contenido;
}

/**
 * Check if a category is child
 * of another category
 *
 * @return boolean true/false
 * @author Jan Lengowski <Jan.Lengowski@4fb.de>
 * @copyright four for business AG 2003
 */
if (!function_exists("catIsChildOf"))
{
    function catIsChildOf($id, $idparent) {
    
        global $cfg, $client, $lang;
    
        $db = new DB_Contenido;
    
        $parent = $id;
    
        while ( $parent != 0 ) {
    
            $sql = "SELECT
                        a.parentid
                    FROM
                        ".$cfg["tab"]["cat"]." AS a,
                        ".$cfg["tab"]["cat_lang"]." AS b
                    WHERE
                        a.idclient  = '".$client."' AND
                        b.idlang    = '".$lang."' AND
                        a.idcat     = b.idcat AND
                        a.idcat   = '".$parent."'";
    
            $db->query($sql);
            $db->next_record();
    
            $parent = $db->f("parentid");
    
            if ($parent == $idparent) {
                return true;
            }
    
        }
    
        return false;
    
    }
}

if ( catIsChildOf($idcat, "CMS_VALUE[0]") ) {
    $sel_idcat = $idcat;
} else {
    $sel_idcat = "CMS_VALUE[0]";
}

/* Include Template Class */
include_once($cfg["path"]["contenido"] . 'classes/class.template.php');

/**
 * Array storing alle the
 * navigation data
 */
$navitems = array();


/* Template Instance */
$tpl = new Template;

/**
 * Recursive function for creating
 * the navigation array
 * @param Int $idcat Category id
 */
function nav($idcat) {

        global $navitems, $client, $lang, $cfg;

        $db  = new DB_Contenido;
        $db2 = new DB_Contenido;

        $sql = "SELECT parentid FROM ".$cfg["tab"]["cat"]." WHERE idcat = '$idcat'";

        $db->query($sql);
        $db->next_record();

        $parentid = $db->f("parentid");

        if ( $parentid == 0 ) {

           if ( $idcat != "CMS_VALUE[0]" ){

                $navitems = array();
              
                $sql = "SELECT
                            A.idcat,
                            C.name
                        FROM
                            ".$cfg["tab"]["cat_tree"]." AS A,
                            ".$cfg["tab"]["cat"]." AS B,
                            ".$cfg["tab"]["cat_lang"]." AS C
                        WHERE
                            A.idcat     = B.idcat   AND
                            B.idcat     = C.idcat   AND
                            B.idclient  = '$client' AND
                            C.idlang    = '$lang'   AND
                            C.visible   = '1'       AND
                            B.parentid  = 'CMS_VALUE[0]'
                        ORDER
                            BY A.idtree";

                      $db->query($sql);

                      while ($db->next_record()) {

                            /* Check for external redirects... */
                            $sql = "SELECT
                                        a.external_redirect AS ext
                                    FROM
                                        ".$cfg["tab"]["art_lang"]." AS a,
                                        ".$cfg["tab"]["cat_art"]." AS b,
                                        ".$cfg["tab"]["cat"]." AS c
                                    WHERE
                                        b.idcat     = '".$db->f("idcat")."' AND
                                        b.is_start  = '1' AND
                                        c.idclient  = '".$client."' AND
                                        c.idcat     = b.idcat AND
                                        a.idart     = b.idart AND
                                        a.idlang    = '".$lang."'";

                            $db2->query($sql);
                            $db2->next_record();

                            $target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';

                            $navitems[$db->f("idcat")] = array("idcat"      => $db->f("idcat"),
                                                                "name"      => $db->f("name"),
                                                                "target"    => $target);
                      }

           }
           
           return true;
        }

        $sql = "SELECT
                    A.idcat,
                    C.name
                FROM
                    ".$cfg["tab"]["cat_tree"]." AS A,
                    ".$cfg["tab"]["cat"]." AS B,
                    ".$cfg["tab"]["cat_lang"]." AS C
                WHERE
                    A.idcat     = B.idcat   AND
                    B.idcat     = C.idcat   AND
                    B.idclient  = '$client' AND
                    C.idlang    = '$lang'   AND
                    C.visible   = '1'       AND
                    B.parentid  = '$parentid'
                ORDER BY
                    A.idtree";

        $db->query($sql);

        while ($db->next_record()) {

                /* Check for external redirects... */
                $sql = "SELECT
                            a.external_redirect AS ext
                        FROM
                            ".$cfg["tab"]["art_lang"]." AS a,
                            ".$cfg["tab"]["cat_art"]." AS b,
                            ".$cfg["tab"]["cat"]." AS c
                        WHERE
                            b.idcat     = '".$db->f("idcat")."' AND
                            b.is_start  = '1' AND
                            c.idclient  = '".$client."' AND
                            c.idcat     = b.idcat AND
                            a.idart     = b.idart AND
                            a.idlang    = '".$lang."'";

                $db2->query($sql);
                $db2->next_record();

                $target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';
                
                $tmp_nav[$db->f("idcat")] = array("idcat"   => $db->f("idcat"),
                                                  "name"    => $db->f("name"),
                                                  "target"  => $target);
        }

        $tmp_nav[$idcat]["sub"] = $navitems;
        $navitems = $tmp_nav;

        /* Function call */
        nav($parentid);

}  // end function

$sql = "SELECT
            A.idcat,
            C.name
        FROM
            ".$cfg["tab"]["cat_tree"]." AS A,
            ".$cfg["tab"]["cat"]." AS B,
            ".$cfg["tab"]["cat_lang"]." AS C
        WHERE
            A.idcat     = B.idcat   AND
            B.idcat     = C.idcat   AND
            B.idclient  = '$client' AND
            C.idlang    = '$lang'   AND
            C.visible   = '1'       AND
            B.parentid  = '$sel_idcat'
        ORDER BY
            A.idtree";

$db->query($sql);

while ( $db->next_record() ) {

        /* Check for external redirects... */
        $sql = "SELECT
                    a.external_redirect AS ext
                FROM
                    ".$cfg["tab"]["art_lang"]." AS a,
                    ".$cfg["tab"]["cat_art"]." AS b,
                    ".$cfg["tab"]["cat"]." AS c
                WHERE
                    b.idcat     = '".$db->f("idcat")."' AND
                    b.is_start  = '1' AND
                    c.idclient  = '".$client."' AND
                    c.idcat     = b.idcat AND
                    a.idart     = b.idart AND
                    a.idlang    = '".$lang."'";

        $db2->query($sql);
        $db2->next_record();

        $target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';

        $navitems[$db->f("idcat")] = array("idcat"  => $db->f("idcat"),
                                           "name"   => $db->f("name"),
                                           "target" => $target);
}

/* Create Navigation Array */
nav($sel_idcat);

/* Start Output buffer */
ob_start();

echo '<table cellspacing="0" cellpadding="0" border="0">';

foreach ($navitems as $key => $data) {

    /* 1. Navigations Ebene */
    $tpl->reset();
    $tpl->set('d', 'NAME',  $data['name']);
    $tpl->set('d', 'TARGET', $data['target']);
    $tpl->set('d', 'HREF',  $sess->url('front_content.php?idcat='.$data['idcat']));
    $tpl->next();

    if ($idcat == $data['idcat'] || is_array($data['sub'])) {
        $tpl->generate('templates/navfirst_on.html');
    } else {
        $tpl->generate('templates/navfirst_off.html');
    }

    if (is_array($data['sub'])) {

        foreach ($data['sub'] as $key => $data) {

            /* 2. Navigations Ebene */
            $tpl->reset();
            $tpl->set('d', 'NAME',  $data['name']);
            $tpl->set('d', 'TARGET', $data['target']);
            $tpl->set('d', 'HREF',  $sess->url('front_content.php?idcat='.$data['idcat']));
            $tpl->next();

            if ($idcat == $data['idcat'] || is_array($data['sub'])) {
                $tpl->generate('templates/navsecond_on.html');
            } else {
                $tpl->generate('templates/navsecond_off.html');
            }

            if (is_array($data['sub'])) {

                foreach ($data['sub'] as $key => $data) {

                    /* 3. Navigations Ebene */
                    $tpl->reset();
                    $tpl->set('d', 'NAME',  $data['name']);
                    $tpl->set('d', 'TARGET', $data['target']);
                    $tpl->set('d', 'HREF',  $sess->url('front_content.php?idcat='.$data['idcat']));
                    $tpl->next();

                    if ($idcat == $data['idcat']) {
                        $tpl->generate('templates/navthird_on.html');
                    } else {
                        $tpl->generate('templates/navthird_off.html');
                    }

                } // end foreach

            } // end if

        } // end foreach

    } // end if

} // end foreach

echo '</table>';

/* Read out buffer */
$html = ob_get_contents();

/* Clean buffer */
ob_end_clean();

/* Output buffer-contents */
echo $html;

?>
Wär super, wenn Ihr mir da weiterhelfen könnt!

Greetz,
Ben
-Ben-
Beiträge: 2
Registriert: Di 29. Mär 2005, 13:45
Kontaktdaten:

Beitrag von -Ben- »

Jetzt hab ich das Problem doch noch in den Griff bekommen. Für alle, die es interessiert: Der Befehl class="hauptnav" muss in die entsprechenden Templates und nicht in Modul-Code eingefügt werden.

Code: Alles auswählen

<!-- BEGIN:BLOCK -->
<tr><td width="165" colspan="2" height="22" style="border: 0px; border-bottom:1px; border-color: #000000; border-style: solid; background-color: #ffd0a5; padding-left:10px">
<a target="{TARGET}" href="{HREF}" class="hauptnav">{NAME}</a></td></tr>
<!-- END:BLOCK -->
Gesperrt