Index du Forum » » Bugs, Probs ...

Auteur

Balise [pageX]
Sylvain
48    

  Posté : 26-05-2015 15:13

Bon, c'est fait.
Ça a été long, mais ça marche.Dans sections.php il a fallut modifier le fonction "viewarticle".

global $numpage;
$numpage=$page;

sert à faire fonctionner le programme de construction des listes de pages (voir http://www.npds.org/viewtopic.php?topic=26307&forum=9).

function viewarticle($artid, $page) {
   global $NPDS_Prefix;
   global $prev, $user;
   global $numpage;
   $numpage=$page;
   if (file_exists("sections.config.php"))
      !include! ("sections.config.php"); < br />
   if ($page=="")
      sql_query("update ".$NPDS_Prefix."se ccont set counter=counter+1 where artid='$artid'");

   $result_S = sql_query("select artid, se cid, title, content, counter, userlevel from ".$N PDS_Prefix."seccont where artid='$artid'");
   list($artid, $secid, $title, $Xcontent,  ;$counter, $userlevel) = sql_fetch_row($result_S);
   list($secid, $secname, $rubid) = sql_fe tch_row(sql_query("select secid, secname, rubid from " .$NPDS_Prefix."sections where secid='$secid'"));
   list($rubname) = sql_fetch_row(sql_query("select& nbsp;rubname from ".$NPDS_Prefix."rubriques where rubid='$r ubid'"));
   $tmp_auto=explode(",",$userlevel);
   while (list(,$userlevel)=each($tmp_auto)) {
      $okprint=autorisation_section($userlevel) ;
      if ($okprint) break;
   }
   if ($okprint) {
      $old_title=$title;
         $pindex=substr(substr($ page,5),0,-1);
         if ($pindex!="")&n bsp;{$pindex=" - ".translate("Next Page")." ".$pindex;}
         if ($sections_chem in) {
            $titl e=aff_langue($rubname)." - ".aff_langue($secname)." - ".aff _langue($title)." ".$pindex;
         } else {
            $titl e=aff_langue($title)." ".$pindex;
         }
         !include!("header.php") ;
      $title=aff_langue($old_title);

      global $SuperCache;
      if ($SuperCache) {
         $cache_obj =  new cacheManager();
         $cache_obj->startCac hingPage();
      } else {
         $cache_obj =  new SuperCacheEmpty();
      }
      if (($cache_obj->genereting_outpu t==1) or ($cache_obj->genereting_output==-1) or (!$Super Cache)) {
         $words = size of(explode(" ", $Xcontent));
         if ($prev==1)  ;{echo "<input class=\"bouton_standard\" type=\"button\"  ;value=\"".translate("Back to console")."\" !onclick!=\"!javascr ipt!:history.back()\" /><br /><br />";}
         if (function_exist s("themesection_title")) {
            theme section_title($title);
         } else {
            opent able();
            echo& nbsp;$title;
            close table();
         }
         opentable();
//         echo "<p  ;align=\"right\">($words ".translate("total words in thi s text)")."  -  
//         ".translate("read:"). " $counter ".translate("times")."    
//         <a href=\"sec tions.php?op=printpage&artid=$artid\"><img src=\"";
//         if ($ibid=theme_ image("box/print.gif")) {$imgtmp=$ibid;} else {$imgtmp="images/p rint.gif";}
//         echo "$imgtmp\"& nbsp;border=\"0\" alt=\"" . translate("Printer Friendly&nbs p;Page")."\" align=\"center\" /></a></p>";
         echo "<div  ;class=\"separ\"></div>";
         if ($page!="")&nbs p;{
//          $Xcontent=subst r($Xcontent,strpos($Xcontent,$page)+7);
            $Xcon tent=substr($Xcontent,strpos($Xcontent,$page)+strlen($page));

            $mult ipage=true;
         } else {
            $mult ipage=false;}
         $pos_page=strpos($Xcont ent,"[page");
         $longueur=mb_strpos($Xc ontent,"]",$pos_page)-$pos_page+1;
        if ($pos_page) {
            $page S=substr($Xcontent,$pos_page,$longueur);
            $Xcon tent=substr($Xcontent,0,$pos_page)."<p align=\"center\"><a h ref=\"sections.php?op=viewarticle&artid=$artid&page=$pageS\" class =\"noir\">".translate("Next Page")."</a></p>";
         } else if($mu ltipage) {
//            $Xc ontent.="<p align=\"center\"><a href=\"sections.php?op=viewa rticle&artid=$artid\" class=\"noir\">".translate("Top of  the article")."</a></p>";
            $Xcon tent.="<p align=\"center\"><a href=\"sections.php?op=viewart icle&artid=$artid&page=[page0]\" class=\"noir\">".translate("To p of the article")."</a></p>";
         }
         $Xcontent=aff_code(aff_ langue($Xcontent));
         echo meta_lang($Xc ontent);
//         echo "<br&nbs p;/><br />";
         echo "<div  ;class=\"separ\"></div>";
//         echo "<br&nbs p;/>";

         if ($togglesection )
            !incl ude!_once ("lib/togglediv.class.php");

         $artidtempo=$artid;
         if ($rubname!="Div ers") {
            $rowc olor=tablos();
            $rowc olor=tablos();
            echo& nbsp;"<span class=\"noir\"><b>".translate("Back to c hapter:")."</b></span>";
            echo& nbsp;"<table width=\"100%\" border=\"0\" cellpadding=\"1\"&nb sp;cellspacing=\"1\" $rowcolor>
            <t r><td><ul><li><a href=\"sections.php?op=listarticl es&secid=$secid\" class=\"noir\">".aff_langue($secname)."</a> </li></ul></td></tr></table>";

            $resu lt3 = sql_query("select artid, secid, title, user level from ".$NPDS_Prefix."seccont where (artid<>'$ar tid' and secid='$secid') order by ordre");
            $nb_a rticle = sql_num_rows($result3);
            if&nb sp;($togglesection)
              ;  $toggle = new ToggleDiv(2);
            if&nb sp;($nb_article > 0) {
//            &nb sp;  echo "<br />";
              ;  if ($togglesection)
              ;     echo $toggle->Img();
              ;  echo "<span class=\"noir\"><b>".translate("O ther courses in chapter:")."</b></span>";
              ;  if ($togglesection)
              ;     echo $toggle->Begin();
              ;  echo "<table width=\"100%\" border=\"0\" ce llpadding=\"1\" cellspacing=\"1\" $rowcolor><tr><td>&l t;ul>";
              ;  while (list($artid, $secid, $title, $userlevel ) = sql_fetch_row($result3)) {
              ;     $okprint2=autorisation_section($userlevel);
              ;     if ($okprint2) {
              ;        echo "<li><a&nbs p;href=\"sections.php?op=viewarticle&artid=$artid\" class=\"noir\"> ".aff_langue($title)."</a></li>";
              ;     }
              ; }
              ; echo "</ul></td></tr></table>";
              ; if ($togglesection)
              ;    echo $toggle->End();
            }
         }
         $artid=$artidtempo;
         $resultconnexe =&n bsp;sql_query("select id2 from ".$NPDS_Prefix."compatsujet  where id1='$artid'");
         if (sql_num_rows($ resultconnexe) > 0) {
            echo& nbsp;"<br />";
            if&nb sp;($togglesection)
              ;  echo "<br />".$toggle->Img();
            echo& nbsp;"<span class=\"noir\"><b>".translate("You may b e interested in:")."</b></span>";
            if&nb sp;($togglesection)
              ;  echo $toggle->Begin();
            echo& nbsp;"<table width=\"100%\" border=\"0\" cellpadding=\"1\"&nb sp;cellspacing=\"1\" $rowcolor><tr><td><ul>";
            while (list($connexe) = sql_fetch_row($resultconnexe)) {
              ;  $resultpdtcompat = sql_query("select artid, ti tle, userlevel from ".$NPDS_Prefix."seccont where arti d='$connexe'");
              ;  list($artid2, $title, $userlevel) = sql_fetch_ row($resultpdtcompat);
              ;  $okprint2=autorisation_section($userlevel);
              ;  if ($okprint2) {
              ;     echo "<li><a href=\"sections. php?op=viewarticle&artid=$artid2\" class=\"noir\">".aff_langue($tit le)."</a></li>";
              ;  }
            }
            echo& nbsp;"</ul></td></tr></table>";
            if&nb sp;($togglesection)
              ;  echo $toggle->End();
         }
         closetable();
      }
      sql_free_result($result_S);
      if ($SuperCache) {
         $cache_obj->endCachi ngPage();
      }
      !include! ('footer.php');
   } else {
      header("Location: sections.php");
   }
}


Attention, je ne garanti pas le fonctionnement dans toutes les configurations,
notamment l'impression des pages.

Le résultat:
http://busmuli.chez.com/sections.php?choice_user_language=french&op=viewarticle&artid=3&page=[page10]



Cet article provient de NPDS

http://www.npds.org/viewtopic.php?topic=26304&forum=1