website logo
Auteur
avatar
GiamDoc

Forum » » Thèmes Dynamic » » Faire des blocs differents ...


Posté : 23 sept. 2006 à 17:52 icone du post

d'aprés le code du mainfile c'est :

     // For including CLASS AND URI in Block
      global $B_class_title, $B_class_content;
      $B_class_title=""; $B_class_content=""; $R_uri="";
      if (stristr($content,"class-") or stristr($content,"uri")) {
         $tmp=explode("\n",$content);
         $content="";
         while(list($id,$class)=each($tmp)) {
            $temp=explode("#",$class);
            if ($temp[0]=="class-title") {
               $B_class_title=str_replace("\r","",$temp[1]);
            } else if ($temp[0]=="class-content") {
               $B_class_content=str_replace("\r","",$temp[1]);
            } else if ($temp[0]=="uri") {
               $R_uri=str_replace("\r","",$temp[1]);
            } else {
               if ($content!="") {$content.="\n ";}
               $content.=str_replace("\r","",$class);
            }
         }
      }

      // For BLOC URIs
      if ($R_uri) {
         global $REQUEST_URI;
         $page_ref=basename($REQUEST_URI);
         $tab_uri=explode(" ",$R_uri);
         $R_content=false;
         $tab_pref=parse_!url(!$page_ref);
         $racine_page=$tab_pref[path];
         $tab_pref=explode("&",$tab_pref[query]);
         while (list(,$RR_uri)=each($tab_uri)) {
            $tab_puri=parse_!url(!$RR_uri);
            $racine_uri=$tab_puri[path];
            if ($racine_page==$racine_uri) {
               $tab_puri=explode("&",$tab_puri[query]);
               while (list($idx,$RRR_uri)=each($tab_puri)) {
                  if (substr($RRR_uri,-1)=="*") {
                     // si le token contient *
                     if (substr($RRR_uri,0,strpos($RRR_uri,"="))==substr($tab_pref[$idx],0,strpos($tab_pref[$idx],"=")))
                        $R_content=true;
                  } else {
                     // sinon
                     if ($RRR_uri!=$tab_pref[$idx]) {
                        $R_content=false;
                     } else {
                        $R_content=true;
                     }
                  }
               }
            }
         }
         if (!$R_content) $content="";
      }


Cet article provient de NPDS
https://www.npds.org/viewtopic.php?topic=21141&forum=48