TinyMCE Page Break BETA

The 'Page Break' button in the TinyMCE editor allows external pagination javascripts to be used with the system if desired. The SiteBuilder does not have any pagination scripts within its core code.

If you'd like to add pagination, you can use the simple modification below. This update will separate a single page wherever the page break tag is added, turning one page content into a several page document.

Please note that this mod hides all content and displays just one area at a time. This means that all images, styles and code will be loaded when you first view the page, even though only part of the content will appear.

  1. Open the content.php file in the /enc/ folder.

  2. Change the following code:

    // Display content only upon first initial page startup
    if (($dirname == SB_PAGE_DIR OR ($pg_type == "required" AND $pgnm_noext == "index") OR ($dirname == "" AND $_SERVER['REQUEST_METHOD'] == "GET" AND !$_SERVER['QUERY_STRING'])) AND $pg_content)
    {
    $pg_content = str_replace("../$Image_Dir/", "$URL/$Image_Dir/", $pg_content);
    $pg_content = str_replace("../$ThumbnailImage_Dir/", "$URL/$ThumbnailImage_Dir/", $pg_content);
    $pg_content = str_replace("../$LgImage_Dir/", "$URL/$LgImage_Dir/", $pg_content);
    $pg_content = str_replace("../$CatImage_Dir/", "$URL/$CatImage_Dir/", $pg_content);
    echo trim($pg_content);
    }
    

    as follows:

    1. METHOD 1: Shows just a teaser; clicking 'more' will show the rest of the content.

      // Display content only upon first initial page startup
      if (($dirname == SB_PAGE_DIR OR ($pg_type == "required" AND $pgnm_noext == "index") OR ($dirname == "" AND $_SERVER['REQUEST_METHOD'] == "GET" AND !$_SERVER['QUERY_STRING'])) AND $pg_content)
      {
      $pg_content = str_replace("../$Image_Dir/", "$URL/$Image_Dir/", $pg_content);
      $pg_content = str_replace("../$ThumbnailImage_Dir/", "$URL/$ThumbnailImage_Dir/", $pg_content);
      $pg_content = str_replace("../$LgImage_Dir/", "$URL/$LgImage_Dir/", $pg_content);
      $pg_content = str_replace("../$CatImage_Dir/", "$URL/$CatImage_Dir/", $pg_content);
      // NO PAGE BREAKS
      if (str_replace("", "", $pg_content) == $pg_content)
      echo trim($pg_content);
      // PAGE BREAKS
      else
      {
      $exppgcontent = explode("", trim($pg_content));
      $exppgcount = count($exppgcontent);
      echo "
      " .$exppgcontent[0] ." more
      "; echo ""; } }
    2. METHOD 2: Shows just the first page, along with page numbers. Clicking the page numbers will display the other pages of content.

      // Display content only upon first initial page startup
      if (($dirname == SB_PAGE_DIR OR ($pg_type == "required" AND $pgnm_noext == "index") OR ($dirname == "" AND $_SERVER['REQUEST_METHOD'] == "GET" AND !$_SERVER['QUERY_STRING'])) AND $pg_content)
      {
      $pg_content = str_replace("../$Image_Dir/", "$URL/$Image_Dir/", $pg_content);
      $pg_content = str_replace("../$ThumbnailImage_Dir/", "$URL/$ThumbnailImage_Dir/", $pg_content);
      $pg_content = str_replace("../$LgImage_Dir/", "$URL/$LgImage_Dir/", $pg_content);
      $pg_content = str_replace("../$CatImage_Dir/", "$URL/$CatImage_Dir/", $pg_content);
      // NO PAGE BREAKS
      if (str_replace("", "", $pg_content) == $pg_content)
      echo trim($pg_content);
      // PAGE BREAKS
      else
      {
      $exppgcontent = explode("", trim($pg_content));
      $exppgcount = count($exppgcontent);
      $displaypages = "";
      $displaypagecontent = "";
      $displaypgscript = "";
      for($xp=0; $xp<$exppgcount; ++$xp)
      {
      $px = $xp+1;
      if ($xp>0)
      $displaypages .= " | ";
      $displaypages .= "$px";
      $displaypagecontent .= "
      0) $displaypagecontent .= " style="display: none;""; $displaypagecontent .= ">"; $displaypagecontent .= $exppgcontent[$xp]; $displaypagecontent .= "
      "; $displaypgscript .= "document.getElementById('clickout$px').style.display = 'none'; "; $displaypgscript .= "document.getElementById('pgclick$px').style.fontWeight = 'normal'; "; } echo "

      $displaypages

      "; echo $displaypagecontent; ?>
  3. Save the file.