Page 2 of 2

Posted: Tue 21. Mar 2006, 10:46
by flip-flop
Ja das geht. :D

# {NAV_LIST_SETLEVEL:back:0 :0 :1 :1:id } – erklärt/ explained:
# :back name for upper level (blank for auto)
# :0 show upper level link (1: yes, 0:no)
# :0 set wich level to display (>= 0)
# :1 autohide? (1: yes, 0:no)
# :1 preserve background? (1: yes, 0:no)
# :id set css-id (anything, default is levelsensitive)

Hier gut zu sehen: Die obere NAVI ist NAV_LIST_FROM alles ander NAV_LIST_SETLEVEL: http://www.art-varij.de/index.php
(EN noch nicht implementiert, aber kein Problem es ist genau wie Dein Strickmuster)

Posted: Tue 21. Mar 2006, 19:04
by Benny
{NAV_LIST_SETLEVEL:Home:1:2:0:1:list_top} oder {NAV_LIST_SETLEVEL:Home:1:51:0:1:list_top} klappt nicht. 51 ist die ID der deutsch Ebene. Angezeigt wird nur ein unformatiertes Home :(

Posted: Tue 21. Mar 2006, 19:32
by flip-flop
Setzte mal
{NAV_LIST_SETLEVEL:Home:1:1:0:1:list_top}

Der RT arbeitet level- nicht ID-basiert.
# This RT is working level-based.

Hier was ID-basiertes:
# This RT is working ID-based

NAV_LIST_FROM sollte auch gehen:
# NAV_LIST_FROM is working well:
z.Bsp.: {NAV_LIST_FROM:1:1:Home:list_top}
# e.g. {NAV_LIST_FROM:1:1:Home:list_top}

unter /phpwcms_template/inc_script/frontend_render/
in "reptag_nav_list_from.php" ablegen.

# please save this code at "/phpwcms_template/inc_script/frontend_render/" into "reptag_nav_list_from.php"

(Leicht fehlerbereinigt)
# (errorsettled)

Code: Select all

<?php 

// The replacement tag sound like this:
// {NAV_LIST_FROM:site_structure_id:grounding:home_name:class_name} 
// http://www.phpwcms.de/forum/viewtopic.php?t=4275&highlight=navrow+css

function css_list_from($struct, $struct_path, $level, $grounding=0, $homelink="Home", $class="list_top", $starting="0", $link_to="index.php" ) {
   // returns list <div><ul><li></li></ul></div> of level 0
   // if $homelink is not empty it will also create a "Home" link
   // you can set $homelink to the name you like
   // predefined class for this menu is "list_top"   
   
   if(!trim($class)) $class = "list_top";
   $homelink = trim($homelink);
   $level = intval($level);
   $activated = 0; //no active list set
   $css_list = "";
    $catids = ",";
   
   //returns the complete top level AND home of NON hidden categories
   //$top_struct = return_struct_level($struct, 0);
   if ($starting){
       $starting = intval($starting);
   } else {
   $starting = 0;
   }
   
   $top_struct = return_struct_level($struct, $starting);


   //return complete cat path as string
   while ($level) {
      $catids .= "$level,";
      $level = $struct[$level]["acat_struct"];
   }

   if(sizeof($top_struct)) {
      foreach($top_struct as $key => $value) {
       
         $thisactive = 0;
         $link  = $link_to."?";
         $link .= ($top_struct[$key]["acat_alias"]) ? html_specialchars($top_struct[$key]["acat_alias"]) : "id=".$key.",0,0,1,0,0";
         $css_list .= "    <li";
         
         if ($grounding) {
           if (strstr($catids, ",".$top_struct[$key]["acat_id"].",")) $thisactive = 1;
         } else if($struct_path[$key]) $thisactive=1;

         if($thisactive) {
           $css_list .= " id=\"".$class."_active\"";
             $activated = 1;
         }
                   
         $css_list .= '><a href="'.$link.'"';
         $css_list .= (!$thisactive) ? "" : " id=\"".$class."_active_link\""; // kh class nach id
         $css_list .= ' target="_top">'.html_specialchars($top_struct[$key]["acat_name"])."</a>";
         $css_list .= "</li>\n";
      }
   }
   
   if($homelink) {
      $css_list_home  = "    <li id=\"".$class. ((!$activated) ? "_home_active" : "_home") ."\">";
      if($starting > 0){
      $css_list_home .= '<a href="'.$link_to.'?id=' . $starting . ',0,0,1,0,0"';
   } else {
      $css_list_home .= '<a href="'.$link_to.'?id=0,0,0,1,0,0"';
   }
      $css_list_home .= ($activated) ? "" : " id=\"".$class."_home_active_link\""; // kh class nach id
      $css_list_home .= ' target="_top">'.html_specialchars($homelink)."</a>";
      $css_list_home .= "</li>\n";
      $css_list = $css_list_home . $css_list;
   }
   if($css_list) {
      $css_list = "<div id=\"".$class."\">\n  <ul id=\"".$class."_ul\">\n". $css_list ."  </ul>\n</div>";
   }
   return $css_list;
}


// List based navigation with Starting Level

if( ! ( strpos($content["all"],'{NAV_LIST_FROM')===false ) ) {
   $content["all"] = str_replace('{NAV_LIST_FROM}', css_list_top($content["struct"],$content["cat_path"],$content["cat_id"]), $content["all"]);
   // creates a list styled top nav menu | {NAV_LIST_TOP:level:grounding:home_name:class_name} | defaults 0:home:list_top
   //$content["all"] = preg_replace('/\{NAV_LIST_TOP:(.*?):(.*?):(.*?)\}/e', 'css_list_top($content["struct"],$content["cat_path"],$content["cat_id"], "$1", "$2", "$3")', $content["all"]);
   $content["all"] = preg_replace('/\{NAV_LIST_FROM:(.*?):(.*?):(.*?):(.*?)\}/e', 'css_list_from($content["struct"],$content["cat_path"],$content["cat_id"], "$2", "$3", "$4", "$1")', $content["all"]);

}
?>

Posted: Tue 21. Mar 2006, 19:48
by Benny
1, 2, 3 alles geht nicht, am ende steht nur Home oben :(

Posted: Tue 21. Mar 2006, 19:54
by flip-flop
siehe eins hoch, das muss klappen.

Posted: Tue 21. Mar 2006, 20:06
by Benny
klappt, perfekt! danke.