[PAGINATE] cntprt [PB] cntprt [/PAGINATE]

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

Hello

I use it, but for images, the "click enlarge" function doesn't work correctly: the image opens in the same window, not in a popup.

Any idea?

Thanks
User avatar
Oliver Georgi
Site Admin
Posts: 9906
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

what is your problem?

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

Oliver Georgi wrote:what is your problem?

Oliver
Hi Oliver
the function "click to enlarge" doens't open the image in a popup, but in the same window.

You can try here
User avatar
Oliver Georgi
Site Admin
Posts: 9906
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

what does this have to do with pagination? Check template settings, JavaScript - maybe.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

It is not a template or javascript problem, because one page with [PAGINATION] doesn't open images in a popup, and one page without [PAGINATION] works correctly

Page ok here but without pagination
Page not ok here but with pagination
fopulu
Posts: 359
Joined: Tue 2. May 2006, 14:19
Location: Rhein-Main

Post by fopulu »

That's right.
I got the same Problem! But only with the CP Images (Bilder)....
User avatar
Oliver Georgi
Site Admin
Posts: 9906
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

there is something wrong!!!

Pagination works for "level article listing" only at the moment. The setting under article summary makes no sense at the moment.

All links you have sent are about in-article pagination - sorry. Not what I have meant.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

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:

Code: Select all

$cleaned_output = str_replace("\\","",$pageArray[$thisPageNum-1]);
$pageOutput .= "<div>".$cleaned_output."</div>";
This should allow popups.

Cheers,
:D

(also updated original script on page 1)
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

Thanks, is works great :D
fopulu
Posts: 359
Joined: Tue 2. May 2006, 14:19
Location: Rhein-Main

Post by fopulu »

thanks jsw_nz! :D
Peekay
Posts: 286
Joined: Sun 25. Jul 2004, 23:24
Location: UK

Post by Peekay »

Peekay wrote:The REQUEST_URI function just doesn't work on my setup.
It appears that $_SERVER["REQUEST_URI"] only works on Apache web server, not IIS. I build using IIS as I also do some sites using ASP.

Thx Oliver for the constant. I'll use that instead. :)
ozzimark
Posts: 1
Joined: Tue 24. Apr 2007, 07:27

Post by ozzimark »

nice :D

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 :oops:

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> &nbsp;";
         } else {
	      $pageOutput .= "<a href=\"$this_url\"><<</a> &nbsp;";
         }
      }else{
         $pageOutput .= "<< &nbsp;";
      }
      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 .= ", &nbsp;";
         }
      }	
	if ($thisPageNum < $thisPageCount) {
         $Next = $thisPageNum + 1;
         if( $Next > 1) {
	      $pageOutput .= "&nbsp;<a href=\"$this_url&p=$Next\">>></a>";
         } else {
	      $pageOutput .= "&nbsp;<a href=\"$this_url\">>></a>";
         }
      }else{
         $pageOutput .= "&nbsp;>>";
      }
    $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
?> 
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

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
:D
Post Reply