Topic: Support/Comments for Pagination Plugin  (Read 13713 times)

Pages: 1 [2]  All   Go Down

#21: 1-May-2007, 09:25 AM

betoranaldi
Posts: 226

I was able to get this plugin to do what I wanted.

I will classify this as a beta since I am not an expert php coder. It appears to be working properly for me.

any questions or comments would be greatly apprecited.

Thanks
Brian

* pagenation_with_printing.txt (2.69 KB - downloaded 280 times.)

#22: 27-Jun-2007, 03:58 AM


nlcluigi
Posts: 23

cristiannica.com

WWW
The 2nd version - with pagination do nothing for me:
it put page 1/2/3 for example, but I see the whole content on every page. I'm missing something?

#23: 27-Jun-2007, 06:48 AM

betoranaldi
Posts: 226

The 2nd version - with pagination do nothing for me:
it put page 1/2/3 for example, but I see the whole content on every page. I'm missing something?

If you are talking about the version I created then you will need to create a style in your css:

.hidepage {display:none;}

the purpose of this is to hide the "other pages" when viewing it on screen but it allows you to create a print style sheet and in this style sheet you can set the hidden fields to be visible. therefore the entire story or article will print but only one page will be visible on screen.

#24: 24-Oct-2007, 07:17 PM

zee
Posts: 27

is it possible to give titles for pagination links or are there any addons for that function like joomla's pagebreak bot.
for ex.
{BREAK=Overview}
{BREAK=Specifications}
{BREAK=Conclusion}

And the link are overview, specifications and conclusions instead of next page or page numbers.

#25: 1-Nov-2007, 04:28 PM

Testers

ZAP
Posts: 1,617

Just thought I'd post a slightly different version of this resource in case anyone else finds it useful. I use it as a snippet instead of a plugin (since I only needed to paginate a few documents). Place the snippet call in place of [*content*] in your template to use it this way.

I also added links to each individual page instead of just Previous and Next.

Very minor changes, but maybe someone will use them...

Code:
<?php
$delimiter 
'{BREAK}';
$tplLinkNext '&nbsp;&nbsp;&nbsp;<a href="[+link+]">Next</a>';
$tplLinkPrev '<a href="[+link+]">Previous</a>&nbsp;&nbsp;&nbsp;';
$tplLinkNav '
<div style="margin:10px auto;width:100%;text-align:center;"><p>Page [+current+] of [+total+]<br />
[+linkprev+] [+pagelinks+] [+linknext+]</p></div>
'
;

$pip_content $modx->documentObject['content'];
$pip_pagecontent explode($delimiter,$pip_content);
$pip_pagecount count($pip_pagecontent);

if (
$pip_pagecount 1){

   
$pip_currentpage = isset($_GET["page"]) ? $_GET["page"]: 1;
   if (
$pip_currentpage $pip_pagecount || $pip_currentpage 1) { $pip_currentpage 1; }

   
$char = ($modx->config['friendly_urls'] == 0) ? "&" "?";
   
$url $modx->makeurl($modx->documentObject["id"],'',$char.'page=');

   
$prevpage $pip_currentpage-1;
   
$nextpage $pip_currentpage+1;

   
$linkprev = ($prevpage>0) ? str_replace("[+link+]",$url.$prevpage,$tplLinkPrev) : '';
   
$linknext = ($nextpage>$pip_pagecount) ? '' str_replace("[+link+]",$url.$nextpage,$tplLinkNext);

   
$pagelinks='';
   for(
$i=1;$i<=$pip_pagecount;$i++){
      if(
$i==$pip_currentpage$pagelinks.=' [ '.$i.' ] ';
      else 
$pagelinks.=' <a href="'.$url.$i.'">'.$i.'</a> ';
   }

   
$pip_template str_replace("[+linkprev+]",$linkprev,$tplLinkNav);
   
$pip_template str_replace("[+linknext+]",$linknext,$pip_template);
   
$pip_template str_replace("[+total+]",$pip_pagecount,$pip_template);
   
$pip_template str_replace("[+current+]",$pip_currentpage,$pip_template);
   
$pip_template str_replace("[+pagelinks+]",$pagelinks,$pip_template);

   
$pip_content=$pip_template.$pip_pagecontent[$pip_currentpage-1].$pip_template;
   
}

return 
$pip_content;
?>

"Things are not what they appear to be; nor are they otherwise." - Buddha

"Well, gee, Buddha - that wasn't very helpful..." - ZAP

Useful MODx links: documentation | wiki  | forum guidelines  | bugs & requests  | info you should include with your post | commercial support options

#26: 28-Nov-2007, 04:42 AM


thehen
Posts: 210

WWW
Sorry to revive this thread, but I have a quick question.

On a lot of sites tha pagination navigation appears at both the top and bottom of the page. Is it possible to create multiple instances of the pagination navigation, or how would I go about modifying it so I would be able to?

Thanks  Smiley

#27: 28-Nov-2007, 10:13 AM

Testers

ZAP
Posts: 1,617

You could just add the navigation snippet twice on the page (and if the snippet calls and page are cached, the code will only be executed the first time the page is loaded anyway). Or you could set a MODx plugin at the end of the snippet and use it as many times as you like on the page. You'd do that with something like:

$modx->setPlaceholder('page_navigation',$pip_content);

and then you can just place the placeholder [+page_navigation+] wherever you like.
"Things are not what they appear to be; nor are they otherwise." - Buddha

"Well, gee, Buddha - that wasn't very helpful..." - ZAP

Useful MODx links: documentation | wiki  | forum guidelines  | bugs & requests  | info you should include with your post | commercial support options

#28: 1-Feb-2008, 08:15 AM

betoranaldi
Posts: 226

Did this stop working for anyone with the .9.6.1 update? once I updated, now when i click the next page button... the ?page=2 is appended to the url but is just displays the first page content.

---edit

It seems to be a caching issue. did modx change the way it caches items? It seems this was an old problem (looking at the beginning of this thread)
« Last Edit: 1-Feb-2008, 08:36 AM by betoranaldi »

#29: 1-Feb-2008, 08:35 AM

Foundation

rthrash
Posts: 11,282

WWW
Is the page now set to be cacheable and/or (if used from Zap above) the snippet called cached?
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#30: 1-Feb-2008, 08:48 AM

betoranaldi
Posts: 226

Is the page now set to be cacheable and/or (if used from Zap above) the snippet called cached?

I'm using the original plugin (50% of my documents have multiple pages.)

I have page caching on by default. I haven't had any problems using this plugin this way until i upgraded to 6.1

If i set it so the page does not cache then the plugin starts to work correctly.

The only thing with this is that its going to be tough going through 200+ documents and changing them all to non-cacheable... nevermind the increased server load.

Rather then downgrading to .9.6 i am going to use the snippet above uncached
« Last Edit: 1-Feb-2008, 01:00 PM by betoranaldi »
Pages: 1 [2]  All   Go Up
0 Members and 1 Guest are viewing this topic.