Hi habe mal ne frage zu der oben gezeigten tpl klasse, was muss ich an dieser funktion ändern, da sie im mmTemplate läuft?
Mfg TheBlackAngel
	
							
						
					Mfg TheBlackAngel
PHP Code:
	
	
# parse_if_block()
 #
 # IF-Bloecke verarbeiten
 #
 # Parameter: 1. Name des IF-Blocks (das, was nach dem IF steht)
 #            2. Statuscode (true  => Inhalt anzeigen
 #                           false => Inhalt nicht anzeigen
 #
 # Rueckgabe: -nichts- (Template-Objekt wird modifiziert)
 function parse_if_block($name,$state)
 {
  while(strpos($template,"{IF ".$name."}") !== false)
  {
   # Das alles hier ist nicht wirklich elegant geloest...
   # ... aber solange es funktioniert... ;-)
   $start    = strpos($template,"{IF ".$name."}");
   $tpl_tmp  = substr($template,$start);
   $splitted = explode("{ENDIF}",$tpl_tmp);
   $block = ""; # Kompletter bedingter Block
   $ifs   = 0;  # IF-Zaehler (wird fuer jedes IF erhoeht und fuer jedes ENDIF erniedrigt)
   # {IF}
   for($x=0;$x<sizeof($splitted);$x++)
   {
    $ifs += substr_count($splitted[$x],"{IF"); # Zum Zaehler jedes Vorkommen von IF hinzuzaehlen
    $ifs--;                                    # Zaehler um 1 erniedrigen
    $block .= $splitted[$x]."{ENDIF}";         # Daten zum Block hinzufuegen
    if($ifs == 0)
    {
     # Zaehler wieder 0, also haben wir das Ende des IF-Blocks gefunden :-))
     break;
    }
   }
   $if_block = substr($block,strlen($name)+5,-7); # Alles zwischen {IF} und {ENDIF}
   # {ELSE}
   $else_block = ""; # Alles ab {ELSE}
   $ifs        = 0;  # IF-Zaehler
   $splitted = explode("{ELSE}",$if_block);
   for($x=0;$x<sizeof($splitted);$x++)
   {
    $ifs += substr_count($splitted[$x],"{IF");     # Zum Zaehler jedes Vorkommen von IF hinzuzaehlen
    $ifs -= substr_count($splitted[$x],"{ENDIF}"); # Vom Zaehler jedes Vorkommen von ENDIF abziehen
    if($ifs == 0)
    {
     # Zaehler 0, also haben wir das Ende des IF-Abschnitts gefunden
     # Aus dem Rest den ELSE-Block zusammenbauen
     for($y=$x+1;$y<sizeof($splitted);$y++)
     {
      $else_block .= "{ELSE}".$splitted[$y];
     }
     if($else_block)
     {
      $if_block   = substr($if_block,0,strlen($if_block)-strlen($else_block));
      $else_block = substr($else_block,6);
     }
     break;
    }
   }
   # Block durch die jeweiligen Daten ersetzen
   $replacement = ($state) ? $if_block : $else_block;
   $template = str_replace($block,$replacement,$template);
  }
  $this->set_template($template);
 }