allows you to create multiple page articles -- the topic has been disucussed elsewhere on boards
- in fact goes back some time.
USAGE:
place code in separate html content parts. Needs opening and closing tags:
[PAGINATE] & [/PAGINATE]
then use [PB]
to create multiple page breaks
Code Scheme:
Code: Select all
[PAGINATE] contentpart_1 [PB] contentpart_2 [PB] contentpart_3 [/PAGINATE]

Here is Frontend Screenshot:

Code:
Code: Select all
<?php
define ("REWRITE_ext", ".phtml");
/* if using rewrite two additional rules need to be placed in .htaccess -
also order is important - /subdirectory example is shown here - same would apply to rules for root
RewriteBase /subdirectory
#new
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)_([0-9]+)\.phtml$ /subdirectory/index.php?id=$1,$2,$3,$4,$5,$6&p=$7
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ /subdirectory/index.php?id=$1,$2,$3,$4,$5,$6
#new
RewriteRule ^(.+)_([0-9]+)\.phtml$ /subdirectory/index.php?$1&p=$2
RewriteRule ^(.+)\.phtml$ /subdirectory/index.php?$1
*/
function show_page($pageInput) {
global $phpwcms;
// next line for apache servers
$this_url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
// for non-apache servers uncomment next line (a temporary solution - will update)
// $this_url = FE_CURRENT_URL;
$appendString = "_";
$thisPageNum = 1; // default page
if ($_GET['p']) {
// page # is specified
$thisPageNum = $_GET['p'];
} // end if GET
if(!$phpwcms["rewrite_url"]){ // non rewrite logic
if(intval(strpos($this_url,"&p")!=-1)){
$url_suffix_array = explode("&p", $this_url);
$this_url = $url_suffix_array[0];
}
}else{ // rewrite logic -- get core url address
$url_left = substr($this_url, 0, strrpos($this_url, "/" ) + 1);
$url_right = substr(strrchr($this_url, "/"), 1);
$url_right = str_replace(".phtml", "", $url_right);
$url_array = explode("_", $url_right);
$url_right = $url_array[0];
$this_url = $url_left.$url_right;
} // end if phpwcms["rewrite_url']
$pageArray = explode("[PB]", $pageInput); // now parse the content
$thisPageCount = count($pageArray);
if(($thisPageNum > $thisPageCount) || ($thisPageNum < 1)) {
$thisPageNum = 1;
} // end if thisPageNum
// format output to show which page we are looking
// unless looking at page 1 -- display a mini-navbar for the other pages.
// order can change - this example places navbar at top of output;
if ($thisPageCount > 1) {
$pageOutput = "<div><font size=\"1\"><b>page: </b> ";
for ($i = 1; $i <= $thisPageCount; $i++) {
if ($i == $thisPageNum) {
$pageOutput .= "<b>$i</b>";
}else{
if ($i > 1) {
if(!$phpwcms["rewrite_url"]){
$pageOutput .= "<a href=\"$this_url&p=$i\">$i</a>";
}else{
$pageOutput .= "<a href=\"$this_url".$appendString.$i.REWRITE_ext."\">$i</a>";
}
}else{
if(!$phpwcms["rewrite_url"]){
$pageOutput .= "<a href=\"$this_url\">$i</a>";
}else{
$pageOutput .= "<a href=\"$this_url".REWRITE_ext."\">$i</a>";
}
}
}
if ($i < $thisPageCount) {
$pageOutput .= ", ";
}
}
$pageOutput .= "</font></div>\n";
// select the proper section of content
// NEXT LINE ADDED TO ALLOW POPUPS - ADDED 02/2007
$cleaned_output = str_replace("\\","",$pageArray[$thisPageNum-1]);
$pageOutput .= "<div>".$cleaned_output."</div>";
}
return $pageOutput;
} // end function
// sniff for tag
//UPDATED to strip out preg_replace 'unfriendly' characters
if( ! (strpos($content["all"],'[PAGINATE]')===false)) {
$content["all"] = preg_replace('/\[PAGINATE\](.*?)\[\/PAGINATE\]/se', 'show_page("$1");', $content["all"]);
}
// end script
?>
place in phpwcms_template/inc_script/frontend_render directory
(please note special instructions if using with rewrite = on)
beta atm - not tested in summary yet.
Just posting this as is - maybe someone will find useful.
all best
-john-