We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33039
    • 2 Posts
    Bonjour à tous,

    Je suis très intéressé par modx mais il reste un point obscur à mes yeux : est-il possible de publier un gros article sur plusieurs pages ? Par exemple, pour un très long article qui fait 4 pages, je ne soushaite pas créer un nouveau document pour chaque page mais un seul qui pusse être scindé automatiquement sur 4 pages. Cela est possible avec certains CMS, est-ce le cas avec modx ?
      • 21595
      • 159 Posts
      oui la question m’interesse et pour l’instant je n’ai pas trouvé de propositions dans modx? En plus je voudrais que la pagination se fasse automatiquement au nombre lignes de l’article , par exemple 25 lignes et on passe à une nouvelle page. Tout ce que j’ai trouvé dans le web même en JS ne propose pas ça.
      J’ai trouvé ça . Si qq se sent d’attaque pour l’adapter à modx, quant à moi ça me demanderait 6 mois.
      http://www.bradchoate.com/weblog/2001/11/03/php
      <?php
      function bloggerPagedBody($b,$a = '') {
        // $b is the body of content to output
        // $a is a defined anchor
        global $HTTP_GET_VARS;
        global $PHP_SELF;
        $page = 1; // default page
        if ($HTTP_GET_VARS['page']) {
          // page # is specified
          $page = $HTTP_GET_VARS['page'];
        }
        // split content into an array of pages
        // note: preg_split requires the Perl-compatible regex
        // extension for PHP. If you don't have this installed,
        // you can do something similar with the PHP split function.
        // I chose preg_split because I wanted a case-insensitive
        // token to split pages.
        $paged_body = preg_split("/<pb *\/>/i", $b);
        $total_pages = count($paged_body);
        // if requested page is out of the bounds of our
        // paged content, default to displaying page 1
        if (($page > $total_pages) || ($page < 1)) {
          $page = 1;
        }
        // select the proper page of content
        $b = $paged_body[$page-1];
        // format the anchor if one was specified
        if ($a) {
          $a = "#$a";
        }
        // if more than 1 page was in the content,
        // format output to show which page we are looking
        // at (unless we're looking at page 1) and also
        // display a mini-navbar for the other available pages.
        if ($total_pages > 1) {
          if ($page > 1) {
            $b = "<div>(this"         ." is page $page of $total_pages)</div>\n" . $b;
          }
          $b .= "<div><font size=\"2\"><b>page:</b> ";
          for ($i = 1; $i <= $total_pages; $i++) {
            if ($i == $page) {
              $b .= "<b>$i</b>";
            } else {
              if ($i > 1) {
                $b .= "<a href=\"$PHP_SELF?page=$i$a\">$i</a>";
              } else {
                $b .= "<a href=\"$PHP_SELF$a\">$i</a>";
              }
            }
            if ($i < $total_pages) {
              $b .= ", ";
            }
          }
          $b .= "</font></div>\n";
        }
        return $b;
      }
      ?>
      
        • 20394
        • 134 Posts
        Bonjour,

        Yann, pourrais-tu m’indiquer quels CMS permettent de faire cette apgination ? Merci.
          • 21595
          • 159 Posts
          je connais
          SPIP
          PhpWebThings
            • 33039
            • 2 Posts
            Quote from: mrcou at May 29, 2006, 01:28 AM

            Bonjour,

            Yann, pourrais-tu m’indiquer quels CMS permettent de faire cette apgination ? Merci.

            Bonjour,

            De mémoire, Plume-CMS permet d’organiser un article en chapitre. Ainsi, chaque chapitre sera affiché sur une page.
              • 21595
              • 159 Posts
              Pour un roman c’est pas bon mais, pour un article, si ton texte est organisé en chapitre et sous chapitre tu as cet extraordinaire peit script qui fait tout le boulot
              http://www.dhtmlgoodies.com/index.html?whichScript=toc_maker