Hello Vancouver Drupalites,
I just wanted to say hi and bring a small gift while I was at it. I'm a PHP developer who's been in and around the language since PHP3 days, but am pretty new to drupal. Although I'm a bit of a wanna-be OO elitist, I'm pretty impressed by the flexibility and functionality drupal provides, especially for development.
I was unable to find any sort of module that allowed for pagination within a single node (although to be honest, it could be my poor drupalfu search skills, there's a lot of random information on drupal sites!). In that vein I created a pretty small module that allows for that, available here (drupal 6).
In essence it allows you to select node types for pagination (such as a page or story), then alter the threshold for pagination (say 400 words per page) within the submission form settings of the content type. Then you're done, and all existing and future content of the selected node types will be paginated according to each nodes pagination values.
It uses the same functions that creates teasers, so assuming you've never had an awkwardly chopped off teaser it should split your content quite gracefully. If you re-edit your content to add/remove stuff it'll handle that seamlessly as well. The pagination is provided by drupal's existing pager functionality, so it'll theme appropriately.
If you do end up using it/playing around with it, I'd love some feedback, whether it be feature suggestions or angry tirades. Hope everyone's enjoying the turkey weekend. :)
Comments
Great idea!
That sounds like a great idea! I have trolled the drupal.org site many times and not found this particular piece of functionality, so good on yah.
I suggest applying for a cvs account, double checking the modules carefully for something similar, then creating a new project for your module.
The second step here is pretty important. Check out the 'Duplicated Modules Hall of Fame' for reasons why.
Welcome to the community.
Dave
Such a module does exist.
The paging module creates a filter that allows you to create multiple page nodes:
http://drupal.org/project/paging
Unfortunately, it hasn't been updated to D6 yet. I've used it in D5 though and it works well.
Great
Sounds like either a) a good new module or b) a good add on functionality to the (very simplistic) paging module. Right now I'm leaning towards (a) -- so I encourage you to apply for a CVS account and submit it as a module.
Thanks for the welcome all
Thanks for the welcome all :). I've been granted a CVS account so I'll do some final clean up of the module and post it there shortly.
Hi Dave, I did stumble
Hi Dave,
I did stumble across that module after finishing up my one, I think the problem was I set my search filter for 6.x only modules before hand, and ended up missing that one. I took a closer look at it, and the one issue I have with it is that you have to set specific page breaks, which feels like a "bad" user workflow. I thought about it like creating a document in microsoft word, and how clunky it would feel if you had to set specific page breaks each time (and revisit those breaks if you added/removed content at a later date).
did you find that to be much of an issue?
No issue so far
There hasn't seemed to be an issue with that.
The client that it was set up for likes to have absolute control over how the content is displayed. They publish a lot of different content types and need it to be flexible. For instance, they don't want it breaking between two lines of a poem that belong together. Also, in their use case, they don't specifically have the need to allow page breaks for one single content type, but across a range of content types.
It's not too difficult for them to add the page breaks because they use it alongside TinyMCE. There's a TinyMCE plugin that allows you to insert the breaks and displays a visual line when you do.
Secretly, I was just hoping you'd upgrade that module to D6 so that I don't have to upgrade it when I upgrade their site. ;)
ha :) i'll contact them and
ha :) i'll contact them and see if they want to collaborate, or if they would mind me emulating that feature.
2 minor suggestions
i've tried this module, it's easy to setup and works perfectly. there may be similar modules existing but this one looks great to me. great work, Owen!
but i think there are two things you may consider of,
1) i found that the page numbers start from 0, if changing it to 1, i think it would make more sense to end-users.
for example the second page of an article is referred as page 1, i.e., ...&page=1, if it looks like ...&page=2, that would be better
2) you may consider of the case of clean-urls. compare to
http://www.somesite.com/.../article-title&page=2,
http://www.somesite.com/.../article-title/page2 would give more sense and search engine friendlier.
cheers,
steve
A Drupal Developer
Hi Steve! thanks for the
Hi Steve!
thanks for the feedback,
re: 1 i believe this is how drupal handles pagination by default, i definitely agree with you, but i'm kinda loathe to provide a different "functionality" than what people might expect if they're used to default drupal pagination. i know it's minor but it annoys me too :) perhaps that could be something they could put in quickly for drupal 7.x, since i think it makes more sense for page 2 to actually go to page 2 as well. (and on that note, does anyone know the best way to submit suggestions / patches like that?). i might look into a way to switch all pagination to 1 based instead of 0 based, that sounds like perhaps a better approach than having different pagination schemes.
re: 2 great idea! i found a "clean url's" module for the default list of node style pagination, i'll see if that'll do the job or add that as an option as well
Patch for Drupal's pagination
Hi.
I've proposed a patch to make consistent the GET page variable with the real page number. See http://drupal.org/node/385270
version 1.1
Just a quick update, version 1.1 adds a lot of features talked about here (including manual breaks, and 1 based pagination, as well as a few other fun things). Thanks again for your comments and suggestions.
It's awesome - I love the
It's awesome - I love the table of contents feature, definitely info-architecturally friendly.
I didn't seem to be able to get the [ header = My Section Title ] syntax working when using manual breaks with the table of contents. Am I missing something? The page would break at the proper place, but my custom title didn't seem to take.
Another thought is that this markup should be like
<!-- pagebreak --> and <!--header = My Section Title -->instead? If you disable the pagination module at a later date, you'll have a bunch of [ pagebreak ] remnants in your body text otherwise.Perhaps to improve WYSIWYG support, it would be easiest to just use the same textarea to put the page titles in as for the automatic breaks? I found that really easy to use, and has the added benefit that it doesn't actually add anything to your node text
If anyone has to support TinyMCE, here's some info that will help you set up a page break button:
http://drupal.org/node/247163
version 1.2
Ugh, sorry, this is what happens when one is too scared to unit test drupal modules :) I've corrected that in 1.2 (should be posted shortly). I definitely thought about the <-- pagebreak --> style vs. the one I chose, my concern was requiring admins to setup filters just to get the thing working (the idea of easy configuration makes me very happy, generally speaking :) ), but perhaps the extra layer of configuration is worth it in the long run.
re: Putting page titles in the same text area, I'm definitely open to suggestions, and hopefully I'll hear more support for this (or the current method). The method you suggest makes it easier for storage as well. I was under the impression that having a separate area made it easier to manage (basically I'm trying as best as possible to get away from "archaic" storage of meta data, but then again, this is HTML so there's only so far we can take that perhaps).