Problem mit Advanced Mod Rewrite & Navigations-Modul

Gesperrt
timgroth
Beiträge: 42
Registriert: Do 6. Okt 2005, 15:28
Kontaktdaten:

Problem mit Advanced Mod Rewrite & Navigations-Modul

Beitrag von timgroth » Di 21. Apr 2009, 10:55

Buenos dias!

Ich wollte meine Webseite die auf Contenido 4.8.11 läuft gerade um Advanced Mod Rewrite erweitern.

So wie es scheint, harmoniert dieses allerdings nicht mit meinem Navigations-Modul, da bei der Navigation
als Links immer nur "index.html" ausgegeben wird :cry:

Hier einmal das von mir verwendete Navigations-Modul:

Code: Alles auswählen

<?PHP

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

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];
}

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

/**
 * 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();

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

    /* 1. Navigations Ebene */
    if ($data['idcat'] == $idcat) {
      echo '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'" class="aktiv">'.$data['name'].'</a>';
    }
    else {
      echo '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'">'.$data['name'].'</a>';   
    }
    
    if (is_array($data['sub'])) {
        $entries1 = sizeof($data['sub']);
        foreach ($data['sub'] as $key => $data) {
            /* 2. Navigations Ebene */
            
            $counter1++;
            
            if ($data['idcat'] == $idcat) {
               echo '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'" class="one aktiv';
               if($counter1 == $entries1) { echo ' last'; }
               echo '">'.$data['name'].'</a>';
            }
            else {
               echo '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'" class="one';
               if($counter1 == $entries1) { echo ' last'; }
               echo '">'.$data['name'].'</a>';  
            }


          
            if (is_array($data['sub'])) {
                $entries2 = sizeof($data['sub']);
                $entries2 = $entries2+1;
                foreach ($data['sub'] as $key => $data) {
                    /* 3. Navigations Ebene */
                    
                    $counter2++;
                    
                   if ($data['idcat'] == $idcat) {
                        echo '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'" class="two aktiv';
                        if($counter2 == $entries2) { echo ' last'; }
                        echo '">'.$data['name'].'</a>';   
                   }
                   else {
                         echo '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'" class="two';
                         if($counter2 == $entries2) { echo ' last'; }
                         echo '">'.$data['name'].'</a>';    
                   }
                } // end foreach
            } // end if
         } // end foreach
     } // end if    
} // end foreach


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

/* Clean buffer */
ob_end_clean();

/* Output buffer-contents */
echo "<div id=\"navig\">";
echo $html;
echo "</div>";

?>
Danke schon einmal für eure Hilfe!

GaMbIt_
Beiträge: 674
Registriert: Do 16. Mär 2006, 16:17
Kontaktdaten:

Re: Problem mit Advanced Mod Rewrite & Navigations-Modul

Beitrag von GaMbIt_ » Di 21. Apr 2009, 11:26

Ich würde jetzt mal ins blaue tippen und behaupten dass Du nur auf die Kategorien verlinkst.. und nicht auf die Artikel...

Code: Alles auswählen

echo '<a href="'.$sess->url('front_content.php?idcat='.$data['idcat']).'" class="aktiv">'.$data['name'].'</a>';
Das funktioniert und ist auch gut so...
Aber es wird immer die Kategorie aufgerufen... nicht der Artikel darin... und je nach AMR Einstellungen wird dann halt ein index.php angehängt...
Nützliche Contenido Infos gibts hier: Contenido Wiki

timgroth
Beiträge: 42
Registriert: Do 6. Okt 2005, 15:28
Kontaktdaten:

Re: Problem mit Advanced Mod Rewrite & Navigations-Modul

Beitrag von timgroth » Di 21. Apr 2009, 11:35

Danke, aber das scheint nicht das Problem zu sein. Über die Kategorie-ID müsste AMR ja einen Bezeichner zuweisen können..

GaMbIt_
Beiträge: 674
Registriert: Do 16. Mär 2006, 16:17
Kontaktdaten:

Re: Problem mit Advanced Mod Rewrite & Navigations-Modul

Beitrag von GaMbIt_ » Di 21. Apr 2009, 11:43

?
Was für einen Bezeichner?

Wenn Du eine idcat hast wird der dazugehörige Alias ausgegeben...
wenn Du eine idart hast ebenfalls...

wenn Du aber nur eine idcat hast kannst Du nicht einen Alias erwarten der nur für eine idart zugänglich ist...

Hoffe dass man das jetzt verstehen konnte...
Nützliche Contenido Infos gibts hier: Contenido Wiki

timgroth
Beiträge: 42
Registriert: Do 6. Okt 2005, 15:28
Kontaktdaten:

Re: Problem mit Advanced Mod Rewrite & Navigations-Modul

Beitrag von timgroth » Di 21. Apr 2009, 12:37

Problem behoben... lag an den Einstellungen von AMR... Danke!

Gesperrt