[PAGINATE] cntprt [PB] cntprt [/PAGINATE]
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
Hi Guys,
Just came across this thread... yes there is an issue - so the javascript needs to be cleaned up. So on line 71-72 use a string replace:
This should allow popups.
Cheers,
(also updated original script on page 1)
Just came across this thread... yes there is an issue - so the javascript needs to be cleaned up. So on line 71-72 use a string replace:
Code: Select all
$cleaned_output = str_replace("\\","",$pageArray[$thisPageNum-1]);
$pageOutput .= "<div>".$cleaned_output."</div>";
Cheers,
(also updated original script on page 1)
nice
sometimes forward and backwards buttons are nice. I haven't checked for compatiblity with anything other than my specific setup, but this comes out formatted quite nicely in my opinion.
heads up! - i took out the code that allows compatiblity with non-apache and rewrite logic to save a bit of space
sometimes forward and backwards buttons are nice. I haven't checked for compatiblity with anything other than my specific setup, but this comes out formatted quite nicely in my opinion.
heads up! - i took out the code that allows compatiblity with non-apache and rewrite logic to save a bit of space
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(intval(strpos($this_url,"&p")!=-1)){
$url_suffix_array = explode("&p", $this_url);
$this_url = $url_suffix_array[0];
}
$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>";
if ($thisPageNum > 1) {
$Prev = $thisPageNum - 1;
if( $Prev > 1) {
$pageOutput .= "<a href=\"$this_url&p=$Prev\"><<</a> ";
} else {
$pageOutput .= "<a href=\"$this_url\"><<</a> ";
}
}else{
$pageOutput .= "<< ";
}
for ($i = 1; $i <= $thisPageCount; $i++) {
if ($i == $thisPageNum) {
$pageOutput .= "<b>$i</b>";
}else{
if ($i > 1) {
$pageOutput .= "<a href=\"$this_url&p=$i\">$i</a>";
}else{
$pageOutput .= "<a href=\"$this_url\">$i</a>";
}
}
if ($i < $thisPageCount) {
$pageOutput .= ", ";
}
}
if ($thisPageNum < $thisPageCount) {
$Next = $thisPageNum + 1;
if( $Next > 1) {
$pageOutput .= " <a href=\"$this_url&p=$Next\">>></a>";
} else {
$pageOutput .= " <a href=\"$this_url\">>></a>";
}
}else{
$pageOutput .= " >>";
}
$pageOutput .= "</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><br /><br /><center>".$pageOutput."</center>";
}
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
?>
Hi ALL,
Just to let everyone know about OliG's superior solution to this feature, found in newest release (133)
VERY FLEXIBLE.....
Just to let everyone know OliG does listen
...and comes up with a better solution!!!
http://www.phpwcms.de/forum/viewtopic.php?t=14664
Thanks for this special feature Oli!!!
cheers from NZ
john
Just to let everyone know about OliG's superior solution to this feature, found in newest release (133)
VERY FLEXIBLE.....
Just to let everyone know OliG does listen
...and comes up with a better solution!!!
http://www.phpwcms.de/forum/viewtopic.php?t=14664
Thanks for this special feature Oli!!!
cheers from NZ
john