Seite 1 von 1

modrewrite mit vpnavigation ?

Verfasst: Fr 1. Sep 2006, 17:02
von abroess
Hallo !

Ich versuche die URL's von vpnavigation mit den modrewrite zu "verschönern". Da vpnavigation nicht mit "idart" arbeitete, habe ich versucht dies einzubauen. Leider stellt sich der gewollte "Effekt" noch nicht ein. Hat jemand ein paar Tipp's ?

Hier die "Ausgabe":

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname   :	    vpNavigation 0.2
* Author      :     Ingo van Peeren
* Copyright   :     Ingo van Peeren (ingo@van-peeren.de)
* Created     :     30-03-2005
* Modified    :     16-07-2005
************************************************/

$hauptkategorie = "CMS_VALUE[0]";

$navitems = array();

if (!function_exists("getIdart") ) {
  function getIdart ( $idartlang ) {
     global $cfg;

     $db = new DB_Contenido;
     $sql = "SELECT idart FROM " . $cfg["tab"]["art_lang"] . " WHERE idartlang = '" . (int)$idartlang . "'";
     $db->query($sql);
     $db->next_record();

     return (int)$db->f("idart");
  }
}


function nav_feld ($cat) {
global $client, $lang, $cfg, $idcat;

        if (!is_object($db)) {
            $db = new DB_Contenido;
        } 
        $sql = "SELECT
                     A.idcat,
                     B.parentid, 
                     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  = '$cat'
                  ORDER BY
                     A.idtree";

         $db->query($sql);

         while ( $db->next_record() ) {
            $aktiv = "";
            $sub_feld = nav_feld($db->f("idcat"));
            if ($db->f("idcat") == $idcat) $aktiv = "active";
            elseif ($sub_feld["activepath"]) $aktiv = "activepath";
            $nav_feld[] = array("idcat"      => $db->f("idcat"),
                                "name"       => $db->f("name"),
                                "idart"      => getIdart( $db->f("startidartlang") ),
                                "active"     => $aktiv,
                                "sub"        => $sub_feld);
            if ($aktiv != "") $activepath = $aktiv;
         }
         $rv = array("feld"          => $nav_feld,
                     "activepath"    => $activepath);
         return $rv;
}

function liste ($array, $indent = "  ")
{
global $first;

       if (is_array($array["feld"])) {
         if ($first) {
           echo $indent . "		\n<ul id=\"nav\">\n";
           $first = 0;
         }
         else echo $indent . "<ul>\n";
         foreach ($array["feld"] as $menupunkt) {
           if ($menupunkt["active"] == "active") echo $indent . $indent . "<li id=\"active\">\n";
           elseif ($menupunkt["active"] == "activepath") echo $indent . $indent . "<li class=\"activepath\">\n";
           else echo $indent . $indent . "<li>\n";
           if (is_array($menupunkt["sub"]["feld"])) {
             echo $indent . $indent . $indent . "<a class=\"daddy\" href=\"front_content.php?idcat=" . $menupunkt["idcat"] .'&idart='.$menupunkt['idart'] . "\">" . $menupunkt["name"] . "</a>\n";
             liste($menupunkt["sub"], $indent."    ");
           }
           else echo $indent . $indent . $indent . "<a href=\"front_content.php?idcat=" . $menupunkt["idcat"] .'&idart='.$menupunkt['idart'] . "\">" . $menupunkt["name"] . "</a>\n";
           echo $indent . $indent . "</li>\n";
         }
         echo $indent . "</ul>\n";
       }
}

/* Create Navigation Array */
$navitems = nav_feld($hauptkategorie); 

$first = 1;

liste($navitems);

?>

Verfasst: Fr 1. Sep 2006, 17:51
von stese
du musst die query natürlich noch anpassen, damit sie dir die startidartlang zurückgibt:

Code: Alles auswählen

        $sql = "SELECT
                     A.idcat,
                     B.parentid,
                     C.name,
                     C.startidartlang
                   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  = '$cat'
                  ORDER BY
                     A.idtree"; 

Oh oh...

Verfasst: Fr 1. Sep 2006, 18:08
von abroess
... manchmal sieht man(n) vor lauter Bäumen den Wald nicht.

Ein fettes Danke an Dich Stese...Alex !