« Faster MT Publishing with Cache Block | Main | Template Installer v1.1 - Support for MT 4.1 »

Paginate Entries and Comments with Pagination Plugin

Pagination is plugin for Movable Type that enables you to paginate lists of entries. For example, at the bottom of your home page, you could add a "Next" link so your readers can go to "Page 2" and read previous entries. You can display a list of linked page numbers to enable visitors to jump to any page number they want.

With Pagination Pro, you can also paginate your Category, Author, and date-based archives, and even paginate your Entry archives, displaying only a small number of comments on each page.

Try it Now - Live Demo

The MT4 Test Blog has the Pagination Pro plugin enabled. Scroll to the bottom of the home page to see the list of pages and follow the links. Also take a look at an example of a paginated Category archive here. Finally, take a look at a paginated version of a 300+ comment entry here.

How it Works

My goal here was to create a pagination plugin with high performance. I didn't want it to slow down rebuilds, and I wanted pages to display for readers without delay. With these goals in mind, I decided to dynamically render pages 2, 3, 4, and so on. This means that unlike the default for most pages in Movable Type, pages 2+ are not static files that get published to your blog directories. They dynamically rendered by the plugin's page viewer script. Note that this viewer script is Perl-based and does not use MT's built-in PHP-based dynamic publishing system. The benefit of this is that you can virtually any plugin template tags in your paginated templates, and you don't need to use PHP. So when someone views page 2, the script goes into action and builds the page and displays it.

Paginated URLs are clean, ending in index.html?page=2 (or similar). Pagination makes use of mod_rewrite for Apache to keep these URLs clean (most MT sites run on Apache, but there may be some alternative approaches for other web servers).

Page-Level Caching

To speed up dynamic page views and reduce CPU/memory/database usage, Pagination supports (optional) page-level caching, powered by the Cache Block plugin. This means that once the plugins generates the HTML for "page 2", it will store that in the cache for next time. And next time someone wants to see "page 2", it can be quickly fetched from the cache. In my tests, dynamic page views from the cache took about 0.04 seconds, so this is very fast. In the plugin settings you can specify how long to cache pages before refreshing the cache.

Template Tags

Pagination comes with a template module that makes it easy to implement -- in most cases you can simply include the module in your existing templates and it will 'just work'. So you may not need to learn or use the template tags below. But if you want to customize the appearance of your Pagniation links, you can use/edit the following tags:

  • <mt:PaginationPages> - This is a container tag for displaying linked page numbers, previous / next page links, etc. This tag should only be placed inside the following containers: <mt:EntriesFooter>, <mt:EntriesHeader>, <mt:CommentsFooter>, and <mt:CommentsHeader>. There are several arguments:
    • max_pages - (Required) The maximum number of page numbers to display at one time. Note that page numbers will roll forward as readers view higher page numbers, just like Google paginated search results.
    • glue - (Optional) This should contain some text or symbols that you to display bewteen each page number. For example, if you want 1 - 2 - 3, then use glue=" - ".
    • lastn - (Required) The number of items shown on each page. This must match the lastn argument of the parent <mt:Entries> or <mt:PaginatedComments> tag.
    • archive_type - (Optional) For advanced use, you can use this tag to override the archive_type used to calculate the page numbers and links. If omitted, the plugin will use the archive_type of the page being built.
    • class_type - (Optional) For advanced use, this tag will override the type of MT object being counted to determine the number of pages.
  • <mt:PaginationPageNumber> - Used inside a <mt:PaginationPages> container, this tag will display the page number being processed in the loop (not the current page number that is being published/viewed).
  • <mt:PaginationPageLink> - Used inside a <mt:PaginationPages> container, this tag will display the URL to page number being processed in the loop.
  • <mt:IfPreviousPage> - Conditional tag that is true if the page being displayed is 2 or higher.
  • <mt:PaginationPreviousPageLink> - The URL to the previous page.
  • <mt:IfNextPage> - Conditional tag that is true if the currently viewed page is not the last page.
  • <mt:IfNotLastPage> - Conditional tag that is relative to the page being processed, not the page being viewed - returns true if the page being processed is not the final page.
  • <mt:LastPageLink> - The URL to the last page.
  • <mt:LastPageNumber> - The number of the last page.
  • <mt:PaginatedComments> - (Pro only) This is replacement container tag for <mt:Comments>. If you want to paginate the list of comments on an Entry archive, you should use <mt:PaginatedComments> instead of <mt:Comments>. You can use all the same <mt:Comment_____> tags inside the container. Arguments include:
    • show - The number of comments to show per page. (Note that you can also use 'lastn' for this argument)
    • offset - The offset for the page of comments. This should always be set to "$pagination_offset".

Templates Set

Pagination comes with two templates:

  • Pagination - A template module that can be included in other templates to display page links.
  • HTACCESS for Pagination - An index template that builds the required mod_rewrite rules. Important: The output file for this template has been set to "htaccess.txt" on purpose. Some sites have already have a ".htaccess" file and you want to be careful not to overwrite the existing one (for example, if you use MT's PHP dynamic publishing, with my Fast Search plugin or otherwise). Check to see if you already have an .htaccess file and if you do, you may want build this template as "htaccess.txt" and then copy and paste the rules into the appropriate place in your .htaccess file (if using MT's dynamic publishing, paste before the existing rules.) If you want to use this template to build your .htaccess file, you will need to change the output file to ".htaccess".

Requirements

Note: while not required, the Cache Block plugin is needed if you want to use the Pagination caching features.

Installation

  1. Download the zip file and upload the contents of the 'plugins' folder to the 'plugins' directory of your MT installation.
  2. Change the permissions of the /plugins/Pagination/pages.cgi script to 755 (CHMOD 755).
  3. Go to the blog you want and then to Preferences > Plugins and then open the settings for the Pagination plugin. Enable the caching settings if desired, then Save.
  4. Return to the settings and click the "Install Templates" button. This will install the templates mentioned above.
  5. Setup your .htaccess file with the Pagination rules, as described above.
  6. Edit your Main Index template and add the following before the </MTEntries> tag:

    <mt:EntriesFooter>
    <mt:Include module="Pagination">
    </mt:EntriesFooter>

  7. Modify your <MTEntries tag to include the argument offset="$pagination_offset". This is important. Example: <MTEntries lastn="10" offset="$pagination_offset">

  8. (Pro only) Do the same for your "Entry Listing" archive template, for both MTEntries containers.

  9. (Pro only) If you want to paginate your comment listings on your Entry archives, edit the "Comments" template module to replace the <MTComments> container with the MTPaginatedComments container, as discussed above. Be sure to include show="10 offset="$pagination_offset".

Get Pagination Pro

Commercial License for 1 to 10 blogs - $97

Blog Network License for 10+ blogs - $249

Personal License for 1 to 4 blogs - $33

Get Pagination

Pagination is free for personal or commercial use, but you must leave the "powered by" link, which is added automatically below the paginations links.

Download Now

Download Now
Downloads: 1124

As always, comments, questions, and suggestions are welcome.

Rate this entry:

  • Currently 4.2/5
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 4.2/5 (94 votes cast). Powered by the Ajax Rating plugin.

Comments (72)

BadDog Author Profile Page:

When I click the "Install Templates" button I get:

Can't locate object method "install_blog_templates" via package "MT::Plugin::TemplateInstaller" at /App/CMS.pm line 12.

Hi Mark, I'm getting the same error as BadDog.

I think know why that is happening. Presumably you both have the new version of Template Installer (v1.1)? I think a change it that plugin broke some of these "install templates" links.

I will issue an update for one or the other ... or both.

Yes indeed, Mark. I saw that Template Installer was required for this one and figured I better install the new version -- which I did, then immediately Paginate.

Looking forward to the update, and thanks for that quick response.

Thanks for the confirmation.

A new version of Pagination, version 1.03, has just been released, You can now use the same download link above to get it...

Mark, the download doesn't seem to have changed. Still showing 1.02 and locking up.

bensolomon, try clearing your cache and then downloading again. I just double-checked the download file, it is indeed 1.03.

That did it Mark. Thanks. Sorry for the confusion.

Looks very neat and simple. Nice job.

I am having a couple issues which I may puzzle through when I have some time unless you have a quick idea.

1) I'm using multiblog to collate two blogs, call them Mainblog and Asideblog. If a page ends with a Mainblog post, all is good and we go to the next page. However, if a page ends with an Asideblog post, we suddenly pick up the Asideblog context and I get a file not found since I don't have that blog actually publish an index (and don't want it to). Other than not starting any particular day with an Asideblog post (so the page doesn't "end" with a post from that blog, I'm not sure what to do there. I'd like to force it to continue to stay in the Mainblog context if you get me.

2) The paginated pages don't pick up my sidebar content which are includes using SSI. I think I know what that is, because pages after page 1 are not .shtml files, they're .shtml?page=2 files, so the server isn't bothering to pick up the SSI content.

Like I said, looks good, works, though maybe not so perfect for me.

1) As you noticed, this plugin doesn't fully support multi-blog contexts. As you can imagine, it can complicate things when you are trying to decide what the total number of "pages" is. That said, while the counts may not be 100% accurate, you may be able to get the next page to work by explicitly setting the blog context, maybe something like:

<mt:SetVar name="blog_id"><mt:BlogID></mt:SetVar>
<mt:Blogs id="$blog_id">
...pagination tags go here...
</mt:Blogs>

2. The SSIs are not working because those pages are being dynamically rendered by Perl. For the same reason, PHP includes will not work either. A workaround might be something like:

<mt:If name="pagination_page_number">
<mt:Include file="sidebar.html">
<mt:Else>
<!--#include file="sidebar.html" -->
</mt:if>

Mark (or anyone else that could assist me),

I'm having a little trouble with the RewriteEngine code. I was able to generate the page code at the bottom of my index file.

The problem is that when I click on one of the page links, I get a "Page Not Found" error.

The server didn't interpret the codes in the original .htaccess file so I changed the RewriteRule part after the ^(.*)$ to:

http://www.jrgeoffrion.com/cgi-bin/MT/plugins/Pagination/pages.cgi?blog_id=1&lastn=1&1&idx=http://www.jrgeoffrion.com/blog/index.html&path=http://www.jrgeoffrion.com/blog/index.html&page=2

The problem definitely seems to be with this particular line.

Can anyone suggest the correct RewriteRule line for my .htaccess?

Nik:

Hi Mark,

I had succesfully deployed the pagination plug in on my system.
But I am confused with "Apache mod_rewrite"..I dont know what exactly it is and from where will i get this (free version I have the trial on with me..)????
After surfing i was able to get the trial version of this thing and i install it on my machine......
What exactly happening is that I am getting the pagination at the end of my page but once I click on any of the page no. I am getting the blank page with pagination visible........

Can you suggest me any solution to overcome this problem....

I am having the same problem as jrgeoffrion: the pagination links appear at the bottom of my front page where they should, but when I follow a link I get a 404 error.

I agree with jrgeoffrion that this has to be a .htaccess error, since everything else seems to be working fine. Any ideas?

I do have two blogs in this installation of Movable Type 4, but they are entirely separate.

Please help!

jrgeoffrion, it seems as thought the pages.cgi script does not exist at:

http://www.jrgeoffrion.com/cgi-bin/MT/plugins/Pagination/pages.cgi

Can you confirm that this file has been uploaded to this location? One thing to try is to delete the plugin files and re-upload them, just in case.

The Bard, for you, it seems the issue is that your blog and MT installation are on different domains (based on The Accidental Bard).

There are 2 workarounds to this issue. For the examples below, lets assume that blogdomain.com is the current blog domain and mtdomain.com is the domain for the MT install.

1. My preferred method, if you are on a dedicated server, is to add
the following line to your apache config file:

ScriptAlias /cgi-bin/ "/filesystem/path/to/your/mtdomain.com/cgi-bin/"

This basically means that on *any* of you domains, /cgi-bin/ will
always point to the same file-system location. If you do this for
example, blogdomain.com/cgi-bin/mt/mt.cgi would work as well as
mtdomain.com. This also has the benefit of having your MT search
results show on the blogdomain.com domain. It can also makes
things easier for AJAX, as it avoids cross-domain scripting.

2. If #1 is not an option, then you can do the following. Basically
you want to create the needed path on the blogdomain.com domain.
So create the directories so you have blogdomain.ca/cgi-bin/mt/plugins/Pagination/ and upload the
pages.cgi file into that directory. Finally you have to edit the
pages.cgi file so it knows where to find the rest of MT and the plugin
files. So change the line:

use lib "lib", ($ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : "../../lib");

to something like

use lib "lib", "/full/filesystem/path/to/mtdomain.ca/cgi-bin/mt/plugins/Pagination/lib";

and then of course CHMOD 755 the new pages.cgi file.

Hi Mark,
I get the following error, when I try to open the homepage:

Smarty error: [in evaluated template line 5]: syntax error: unrecognized tag 'mtpaginationpages' (Smarty_Compiler.class.php, line 580)

The error appears exactly after the first entry on the homepage.
Is it possible to fix it or should I wait for an update?
Thanks.

PS: I use MT 4.1

Mobilguru,

This plugin cannot currently be used on pages that use MT's PHP-dynamic publishing system. If you change to static publishing then this error will go away. A future version of the plugin may support PHP-dynamic publishing.

Av... :-(
I was so glad that I found this plugin. Apparently there is no way to create a "next" and "previous" link under entries in a category to be able to read the older items. You have to choose between all or an amount you specify in the settings :-(
Do you have any approx. date on when the new plugin will be available?
Thank you in advance Mark.

And I forgot to write... Problem with static publishing is that you have to remember to "publish" and wait for it to finish :-(

Nik:

Hi Mark,

I am able to deploy the pagination plug-in on my system and now able to view the page numbers in the footer. But once i click on the page numbers i am redirected to blank page with only pagination visible...
Only when i click on page number 1 i.e. first page I am able to see the content ...
Please help me where I am making mistake....

Nik:

Hi ,

I found the solution to my problem.....

Anyone who is facing this problem can try the below steps..

1: In the apache folder search for "httpd.conf" file...
2: Now open that file and uncomment the "LoadModule rewrite_module modules/mod_rewrite.so" if it is commented...
3: Now in the same file search for the directory section...
In the directory tag give the file path of .htaccess file ..in my case it is in example folder and then set the AllowOverride to "FollowSymLinks"...

Options FollowSymLinks
AllowOverride FileInfo


Mark,

I had to remove the plug-in after 3 weeks as I had no solution to my issue. I've re-uploaded the plug-in and followed the directions and still experience the issue.

Would you mind taking a look and letter me know if you can find the issue.

My MT install is at: http://www.jrgeoffrion.com/cgi-bin/MT/

And the .htaccess is the www.jrgeoffrion.com root.

Thanks in advance.

JR

Hi Mark,
I have install this plugin and seem it 's work pretty well, but when I click to other page 5 or 6 or 7, it still shows page 1. Please let me know how to fix this.

Using MT 4.1 - Pagination and Cache Block - Was working before Cache Block instal. Pagination works on Catagory pages noe on Main Index.

Anyone seeing this error?

Can't locate object method "build" via package "Force" (perhaps you forgot to load "Force"?) at lib/Pagination/App/Viewer.pm line 330.

Update - line 319 and 320 seems to deal with MT Template.

my $ctx = MT::Template::Context->new;
$ctx->stash( 'blog', $blog );

According to 4.1 updated release notes there is a memory leak in MTTemplate.

Could this be the issue? Do you have any suggestions for a temp work around? I guess shot off Pagination?

Mark - please help when you return.

I fear my problem had something to do with Cache Block(CB). I have removed CB - yet i continue to get the above error on the index.php page.

Here's where it gets interesting... works great on Category pages

What could possibly be different about the Index page to warrant this result.

Note: I do have an old .htaccess file from the updated site. It has the Movable Type inserted code dynamic to make dynamic publishing work. I tried removing it - but that didn't help, so I put it back in. I am not sure I need it for MT4.1 - but I am running the site with "set ea. template" mode so that I can run Fast Search.

Help when/if you can...

A faithful user MT-Hacks products

Hi, Mark! I'm Nina, from Brazil.
First of all, thanks for all your plugins! I just love your work :)

Well, I'm in a little trouble... recently I installed 2 of your plugins, Templates Installer and Pagination. After I finally made it work (it wasn't so easy because I installed MT in a subdomain and my weblog in another subdomain), I tried to set my blog to show only 2 entries at the main index, but the pagination apparently doesn't recognize this config, so it skips some entries inside the pagination links. I don't know if I'm explaining very well, so I'd appreciate if you could go there http://www.confusionless.com/teste4 and take a look.

Sorry for the bad english

Thanks in advance
Nina :)

I've installed the plugin as directed, and in general it's working as advertised, except... (and this is a big one)... my index is a php page (not using dynamic publishing; I just use php for various tasks in my sidebar, etc) and this plugin completely breaks the php on pages two and up. Literally, when I view the source of these pages I see comments reading <!-- php stripped out --> wherever an echo should be (and you can actually see the php code in the source, meaning it's not being evaluated by the server).

So, wtf is up with that? And...

1) Can I fix this somehow?
2) If not, if the plugin is simply incompatible with php, you really ought to make that clear so people don't waste time downloading and installing it.

Anybody can look at my blog and tell me where my error is located? The address is www.jrgeoffrion.com/blog/

I haven't been able to make this work since February 12th and can't seem to get a timely answer.

Otherwise, does anyone have an alternate plug-in solution?

Nina:

Mark, please help us :)

Thanks in advance

Nina:

Did anyone here made the pagination links list more or less than 10 entries per page successfully? Because when I customize it to show more or less than 10 entries, the first page shows correctly, but the other pages show the wrong entries. Please help :)

Thanks in advance

Hi,

This is definitely a great plugin for MT. I had successfully did the installation and necessary setup as instruct by this page.

However, when click on my page 1, 2, 3, ..... its still show the main page of my blog! anyone can tell me whats wrong? Thanks a lot

Cheers,
Jerry Ong

I would like to purchase the lic, but I am having the same problem as Jerry and Supatclub.

I also got a smarty error whenever I clicked on the next or 2, 3, 4 pages of the pagination on both the index and the archives. I had to remove the plugin, which is so frustrating because I'd love to have pagination! Is there a different solution? My pages are all statically built with .php ending.

RAT Author Profile Page:

Hi Mark,

I just implemented the Paginate plugin on MT4.1. Everything seemed to go fine but when I click on another page I get the same Page Not Found error that people above are getting. The page that is displayed appears to be generated from pages.cgi or somewhere else in MT. It is not my standard 404 error page.

Do you have any ideas that I can try? I'm trying to launch my site in MT4 very soon and I need to get things working smooth. I just bought your EntryPost plugin for the re-launch and it works great!

Thanks,
Ron
P.S. - If you want to see what it is doing go to my dev site, http://www.ihatemycubicle.com/CloneofIHMC/.

Hi,

I'm having the same problem as Jerry above, that is:

"However, when click on my page 1, 2, 3, ..... its still show the main page of my blog! anyone can tell me whats wrong?"

Has the developer of the plug in stopped responding to questions? If so, is there another resource that could help us?

Any one, please help!

Thanks in advance
Vincent

khansen:

Here's a tip if clicking on 1, 2, 3, etc produces anomalous behavior:

Make sure your .htaccess "lastn" value matches the lastn value you're using in your template. For example, my MT:Entries tag had lastn="2" (for testing purposes), but in the .htaccess line, it was sending lastn="10". So on each page, Pagination was pulling out 10 entries and only two were being shown.

The .htaccess line looks like this:

RewriteRule ^(.*)$ /plugins/Pagination/pages.cgi?blog_id=1&lastn=2&idx=index.html&path=/mypatch/$1 [L,QSA]

As I said, make sure the lastn value shown above matches that of your template tags.

That's all,
Kyle

RAT Author Profile Page:

Never got it to work. Had to switch to another pagination option. I'll check back occasionally to see if there is a fix.

Here is what I use now...
http://www.aldenbates.com/plugins/pagedarchives.html

Hi Mark,

I have no skills on the backend, but seeing this plugin gave me an idea for a feature I'd love to have - which this plugin may or may not support? (sorry I'm not so swift with interpreting the programming language)

I would like to paginate certain series of posts, for instance: A Tale of a Once-Upon-A-Summer Sailor has seven entries (that I called chapters). It would be sweet to have them linked in chronological sequence with that "next" feature .... skipping the entries in-between that are about other things. I did see a conditional code ... but my question is

could I then do this over again for other series? For instance, the entries re Dialogue under Occupation II?

If this is, indeed, what your plugin enables, how much support will you give me until I learn how to manipulate this all myself?

I have written Mark several times about the error I have. Over a period of several months - no reply.

The requested URL //plugins/Pagination/pages.cgi was not found on this server.

You think after purchasing the product that I could receive some support.

This is very disappointing and makes me wary of purchasing other plugins.

Pouya Author Profile Page:

not worked for me, i do every job that you said, and for showing page after page one, got 404 error, not found...

Paul B.:

I get this error after installing Pagination on 4.2rc4 with Dynamic Publishing:

Smarty error: [in evaluated template line 5]: syntax error: unrecognized tag 'mtpaginationpages' (Smarty_Compiler.class.php, line 580)

Is there a patch or a workaround?

Thanks

Sorry to all for the delayed reply.

There are some common problems reported, I will try to address each:

Smarty Errors
The template tags for this plugin arr currently supported under static publishing only. A future version may include support for MT's php-based dynamic publishing.

Page 2+ look the same as Main Index
The .htaccess file is missing the rules for the Pagination plugin, or there is another error with the htaccess file. See step 5 above for details, but you at least 3 lines in your .htaccess, that look something like the follow (note: this is different for each server and blog):

RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
RewriteRule ^(.*)$ /cgi-bin/mt/plugins/Pagination/pages.cgi?blog_id=1&lastn=10&idx=index.html&path=/$1 [L,QSA]

Note that the last line is one long line, starting with RewriteRule and ending with [L,QSA]. To build your own version of this, rebuild the include template and then copy and paste the resulting rules into your .htaccess file. If you already have an existing .htaccess file and already have a line that reads "RewriteEngine On", then place the Pagination rules immediately below that line (you only need one line that says RewriteEngine On.

404 Page Not Found on Pages 2+
There are a few possible causes for this one:

  • The pages.cgi script is not found in the location specified in the .htaccess (must be on the same domain as the blog), or the pages.cgi script does not have proper CHMOD 755 permissions (note that while permissions errors usually result in 500 errors, the .htaccess masks this and shows a 404 instead)
  • Another cause for a not found error (this one styled like your blog), is that the plugin cannot find the correct template to build. Sometimes this is an error with the path= part of the htaccess rule. If you blog root is the root of the domain (such as www.myblog.com), then the htaccess rule should have "path=/$1" -- note the forward slash before the $1. If your blog is a sub-directory, such as www.mysite.com/blog/, then your rule should have the sub-directory too, such as "path=/blog/$1".
  • I hope this helps with some of the common problems. Please reply if any of these don't work. Posting links to your implementation can be helpful, as well as details of your htaccess file.

    MadDog Author Profile Page:

    Hi Mark,

    Thanks for the followup with all of us on the .htaccess file and Page Not Found issues . . .

    I was first exhibiting the problem where page #2 (and succeeding pages) return the same resuilt as page #1. Turned out that I had not renamed the "htaccess.txt" file to ".htaccess" properly. Note to all of you out there exhibiting the same result: don't forget to put the "period" symbol in front of "htaccess". Finally noticed it after looking at Mark's explanation numerous times.

    Problem is, once I renamed the .htaccess file properly, then I started exhibiting the "styled as my blog" Page not Found error. I've reviewed the paths in my .htaccess file (below) and they all seem fine:

    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
    RewriteRule ^(.*)$ /cgi-bin/mt/plugins/Pagination/pages.cgi?blog_id=5&lastn=10&idx=index.html&path=/local_news/$1[L,QSA]

    The offending blog (id #5) is in a subdirectory called "local_news" that resides at the root of the domain. The cgi-bin directory is likewise a folder at the domain root. The syntax for both of these mirror your example.

    I went back and made sure the pages.cgi file was CHMOD-ed to 755.

    Not sure what else to check . . .

    FYI, the site we're developing is at http://www.cobbcircle.net/index2.html and the blog that is exhibiting the Pagination issue is at http://www.cobbcircle.net/localnews/index.html Thanks.

    MadDog Author Profile Page:

    Sorry, the correct syntax for the blog with the pagination issue is http://www.cobbcircle.net/local_news/index2.html

    bizop Author Profile Page:

    Mark, thanks for pointing out that I had to publish the htaccess.txt and use that for my entry into .htaccess

    Here are the first lines of that file;

    RewriteEngine on

    RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
    RewriteRule ^(.*)$ /MT-4.13-en/plugins/Pagination/pages.cgi?blog_id=1&lastn=4&idx=index.html&path=/blog2/$1 [L,QSA]


    order allow,deny
    allow from all

    deny from 65.119.25.226
    deny from 81.95.144.66
    deny from 65.160.238.180

    RewriteCond %{HTTP_HOST} ^bizop.ca$ [OR]
    RewriteCond %{HTTP_HOST} ^www.bizop.ca$
    RewriteRule ^/?$ http://bizop.ca/blog2/ [R=301,L]

    My blog is at the subdirectory blog2 of bizop.ca

    I am now getting the error "Page not found", not a 404 error. See: http://www.bizop.ca/blog2/index.html?page=2

    Suggestions?

    bizop Author Profile Page:

    After some playing around with the re-write rule, I got it to work.

    I put the rewrite after all my other rules, because I have a permanent re-direct of bizop.ca to bizop.ca/blog2, and then I removed "blog2" from the rule.

    Works fine now on the main page, I will use it on category and subcategory pages.

    Yeah!

    dramnok Author Profile Page:

    I'm having the same problem some other folks have mentioned, that all of the numbered pages just wind up giving me a copy of the main index page. I've checked to make sure my .htaccess code is correct and that the lastn values match up. I even tried using a new .htaccess file with just the rewrite code for this plugin, to no avail, so I know it's not my .htaccess file. Something seems broken, and I hate to think I paid for some worthless code. Thoughts?

    dramnok Author Profile Page:

    Never mind - all square now, and it's working quite well.

    dramnok:

    So I've run into a new issue. I use cron to run MT's periodic-tasks file, so that scheduled posts can be published. So far, three scheduled posts have been published and for two of them, the server resources went to pot for about 1-2 minutes, and I got the following error message e-mailed to me from the cron daemon: "Use of uninitialized value in concatenation (.) or string at /public_html/mt/plugins/Pagination/lib/Pagination/Tags.pm line 63." Any thoughts?

    MadDog Author Profile Page:

    Mark, did you get a chance to look at my comments above regarding the continuing Page Not Found error? Have gone through all your suggestions and still getting the error. Maybe I'm missing something, but frustrated, and need to find a solution ASAP. Thanks.

    jim:

    Hi Mark

    I've been using this plugin and it's been working great, but i've just tried it out on a 4.2 install and I'm getting a error when rebuilding.

    Can't use string ('00000001000000") as a subroutine ref while "strict refs" in use at /var/www/cgi-bin/mtcs4.2_clean/plugins/Pagination/Tags.pm line 43.

    Does pagination work on 4.2 or should i wait for a patch?

    MadDog Author Profile Page:

    Well, after a large amount of hair-pulling over the last few weeks, we've managed to get our Pagination Pro installation working. Although we were at first a bit tweaked about not getting a solution response from Mark - in his defense - it seems that we MIGHT have caused our own problem by accidentally inserting an extra carriage return at the end of the .htaccess file when we copied the contents over from htaccess.txt. Since we also upgraded to version 1.5 before discovering the extra carriage return, we're not sure what caused the solution, though we caution everyone who's having the same problem as we were (404 error page styled like the rest of your site) to do 3 steps in this order: 1) follow Mark's instructions to make sure your blog directory syntax in the resultant htaccess file is correct if your blog resides BENEATH the main domain level (Although the "mt:BlogRelativeURL" tag seems to do it correctly on its own in our installation); 2) Check for extra carriage returns being inserted in your .htaccess file when code is copied over from the htaccess.txt file (I know it seems odd, but I don't trust ANY aberration in these little text files); and 3) Upgrade to version 1.5. Whew.

    Hey Mark,

    I followed all the directions but every time I go to preview my Main Index template I get this error:

    "Can't call method "outfile" on an undefined value at /(my-MT-stuff-folder)/plugins/Pagination/lib/Pagination/Tags.pm line 67."

    What does this mean?

    What am I doing wrong?

    I really wanna paginate w/o error.

    Please help.

    Adam Benjamin Irby

    Hi,

    I just purchased the Pro version for my blog, and I cannot get it to work. I installed a previous version (1.01) on a friend's blog, where it works magnificently.

    The blog where I am trying to use it is a fresh install of MT4.21. The only unusual thing is that the blog I wish to paginate is in a subdirectory

    http://bettinamay.com/poem/

    I am getting a 404 error, not styled like my blog. I double checked that the permissions were set correctly on the pages.cgi file. I tried the .htaccess file that comes with the 1.5 version of the plugin, and I tried a version that explicitly set the blog id and path.

    So neither
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
    RewriteRule ^(.*)$ plugins/Pagination/pages.cgi?blog_id=&lastn=10&idx=&path=$1 [L,QSA]

    nor
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
    RewriteRule ^(.*)$ /cgi-bin/plugins/Pagination/pages.cgi?blog_id=2&lastn=10&idx=index.html&path=/poem/$1 [L,QSA]

    works for me.

    Can you offer any assistance.

    Thanks in advance
    Bettina May

    kelp Author Profile Page:

    hi mark

    I have a question relating the .htacess file.

    I have MT installed on the portal www.kelp.cl.
    I am confused with the part where I need to install or rewrite the .htacess file.
    I have installed all the templates on the server and the codes on the website www.kelp.cl BUT I think I only need to configure my .htacess file.
    On the MT templates there is only the: HTACESS for Pagination htaccess.txt (static).

    The question is:
    Do I need to create a new template with the output: .htacess?
    If so what do I have to do then?

    As you can see I am very interested in finding a solution and also no great programmer ;)

    I'd be glad if you could help me out at info@kelp.cl

    Regards from Chile
    Axel

    jenius Author Profile Page:

    Hi,

    I've got the plugin working, it's awesome, thanks! However, because I have MT4.23 installed on a different domain, the paginated pages are showing a different URL.

    For example, http://www.jenius.com.au/index.php?page=3 will show up in the browser address bar as http://iatemywaythrough.com/mt/plugins/Pagination/pages.cgi?blog_id=2&lastn=2&idx=index.php&path=/index.php&page=3.

    Is there any way to mask this URL and only show http://www.jenius.com.au/index.php?page=3?

    Thanks,
    Jen

    Steve:

    Hey, Mark. I too am having the problem of every subsequent page showing the content of my initial page. My problem, I think, is that the url in the htaccess.txt file is not finding the plugin.

    Originally, you have <mt:CGIRelativeURL>plugins/Pagination/pages.cgi

    My <mt:CGIRelativeURL>, though, is: /blogadmin/ -- and my plugins directory is in /srv/www/movabletype/ -- I imagine this poses a problem ... because I cannot get your plugin to work.

    /srv/www/movabletype/ is where all of the CMS-related files are

    /srv/www/blogs/ is where all of the html content is located.

    Could you help shed some light on this recurring first-page content problem, please? Thanks.

    Steve:

    Also, your example blog: http://mt-hacks.com/mt41/index.php?page=3 goes to page not found on your paginated pages.

    Hi Steve,

    Thanks for the report about my test blog -- I will check on that.

    If pages 2+ are showing the same as the initial page, then, yes, this indicates a potential problem with your htaccess rules not get triggered properly.

    What is the content of your htaccess file? Can you are URL of the site you are using it on?

    I don't think this is an issue with your file/path structure. If it was having trouble finding the pages.cgi script, you would probably get a 404 Not Found error, or maybe even a 500 Internal Server error. Your problem seems be with the triggering of the rule. Remember to ensure that the file is named .htaccess -- a few people have forgetten to rename the the file and left it as htaccess.txt, which won't work.

    Steve:

    Hi, Mark. Thanks for getting back to me so quickly. You're right about the htaccess.txt file ... I did leave it as .txt.

    I'll look over again what you recommend us to do if we already have a .htaccess file ... but if you wouldn't mind posting a response, too, I'd appreciate it. I just don't want to interfere with the file that already exists.

    Steve:

    Mark, sorry to spam you like this, but what I'm looking for is the specific directory into which I should put the .htaccess file. Should it be in my blog's htdocs directory or at the CGI root of the MT install? Or elsewhere?

    Thanks.

    Steve:

    I promise I'll try to make this my last post ... I have widgets on my MT pages that contain PHP code, but that code is being stripped out by your pagination plugin. Is there a way to easily prevent or circumvent this? I need that PHP to populated certain variables in those widgets, without it, my pages aren't rendering as I intended.

    Also, where do I set the $pagination_offset variable?

    Thanks again, Mark. And thanks for making this brilliant plugin. It's working like a charm now aside from that PHP conflict.

    Steve, it seems you have figured out where the .htacess should go, but to confirm, it should go in the blog root directory (same place as you main index). If you have an existing .htaccess with rewrite rules, then put the rules right after the "RewriteEngine On" line -- note that you only need one "RewriteEngine On" line in the file. Again, it seems liek you are okay on this part now.

    The $pagination_offset variable gets set by the pages.cgi script, so you don't have to set it in your template, it is preset. You do need to add the offset="$pagination_offset" to your MTEntries tag, as described above.

    There is no way to execute PHP on pages 2+, as they are being dynamically rendered by Perl. Depending on what you are trying to do with the PHP, there may be alternatives that you can use to do the same thing. One example, which may not work in your case, is for PHP includes:

    <mt:If name="pagination_page_number">
    <mt:Include file="file.php">
    <mt:Else>
    <?php include("file.php") ?>
    </mt:if>

    Note that the "pagination_page_number" will be true only on pages 2+, where PHP won't work.

    Mark, sorry to spam you منتديات الوله

    دردشة صوتية

    الولة

    like this, but what I'm looking for is the specific directory into which I should put the .htaccess file. Should it be in my blog's htdocs directory or at the CGI root of the MT install? Or elsewhere?

    Thanks.

    @Adam Benjamin Irby:

    If you happen to come back someday, or if others are helped with the same 'outfile' issue, I had it too with MT 4.24 with Pro Pack. Here is the simple workaround that worked for me:

    I commented out the offending line in Tags.pm, then previewed/saved my template, and then uncommented the line again. I think all is working fine :-)

    Anonymous:



    ">





    Adrian:

    Hi
    Just to clarify something. Does the basic or the pro version work with multiblog?
    I have got the free version to work ok for a blog and the pagination works ok on the first page of the multiblog listing (i want to list all entries 100 at a time off all blogs) but pages 2 etc do not work.

    I have a root dir of /archives/ that has an .htaccess in it that i have tried to hack to ....

    RewriteCond %{QUERY_STRING} ^page=[0-9]+$ [NC]
    RewriteRule ^(.*)$ /cgi-bin/mt/plugins/Pagination/pages.cgi?lastn=100&idx=index.html&path=/archives/$1 [L,QSA]

    But I get no love from the above.
    So is it doable or not. Do i need a different version?

    Thanks

    Mark (or anyone else who knows this issue)

    I'm getting a "Page Not Found" in the author archives of my blogs.

    http://blogs.chesterchronicle.co.uk/cheshire-memories/

    If you click on "My Postings" by any of the authors you enter the author's archives. Once there the pagination fails to work and only brings up a "Page Not Found" error.

    Pagination seems to work for the whole site, such as index page and categories archive, but fails at author archives.

    Anything you can tell me will help

    Thanks

    hi,

    does this pagination plug-in work with MT5?

    Great to hear the story of how things actually developed leading up to the launch of the station. It seems that there was a lot of luck involved.

    Post a comment