[wp-hackers] Revamping the <!--nextpage--> Pagination Function

David Chait davebytes at comcast.net
Wed Nov 8 16:55:52 GMT 2006


My PageNames plugin (which, admittedly, I can't remember if I ever released 
to the public!) does a bunch of this, by allowing the page name as PART of 
the <!--nextpage--> tag, i.e., <!--nextpage:And in other news...-->, or 
something like that.  I believe page 1 defaults to some static string you 
define, but I recall looking at adding a <!--firstpage:Title--> sort of 
thing in.  There's also helper functions for getting the current page name, 
outputting a TOC list, and I seem to recall I had revised a next/prev page 
links function that can optionally print the page names (in addition to page 
number, and user-supplied next/prev strings, as normal).

If you look at any multipage review on chait.net, that's how the toc and 
per-page subtitles are done.

There's definitely arguments for going various directions.  I prefer to have 
the page title at the start of the page it is titling, rather than some 
master list up top, or some custom fields.  Having it at the start of the 
pagebreak means I know what that page is called, and I don't have to worry 
about reordering a single list somewhere if I move stuff around.

There's also a DIFFERENT 'page title' thing, which is really 
single-page-subtitles.  There are I believe multiple plugins that already 
support markup to do that.  Not that they are necessarily orthogonal 
features, but I'd prefer my in-html titles to stay in html, and things that 
are 'theme design' like subpage names I'd like to keep tied to nextpage 
markers.  Even if it's a new tag, like '<!--pagename:Title-->'.

The only other thing to look at would be wrapping a bunch of pieces together 
with a more Word-type concept of sections, heading levels, etc.  That is, an 
'outline' format.  That's what the hN html tags are for to some degree, but 
there's no good semantics associated.

I could probably go hunt down my plugin (it was part of my redesign of my 
site to take full advantage of 2.x and less core hacking), and get it posted 
up somewhere.

-d

----- Original Message ----- 
From: "Computer Guru" <computerguru at neosmart.net>
To: <wp-hackers at lists.automattic.com>
Sent: Wednesday, November 08, 2006 9:43 AM
Subject: [wp-hackers] Revamping the <!--nextpage--> Pagination Function


> Hi guys,
>
> For those of us that use WP more as a CMS than as a blogging platform and
> tend to have longer articles (read: reviews) up on WP, I've constantly 
> been
> less than happy with the pagination process.
>
> WP's current pagination system is good for breaking up long articles into
> smaller bits, but not for breaking up based on logical portions of 
> articles.
> I mean, it's not for use with a Table of Contents and post-page titles.
>
> How hard would it be to completely redo the pagination process? I just
> finished my exams and have *some* spare time and am willing to work on it.
> The only problem is, I don't see how a revamped <!--nextpage--> function
> would work.
>
> The problem is that it is an immediate call without pre-planning. WP finds
> the occurrences and explode()s based on them.
>
> Would it work to add a custom field called "page headers" and have it act 
> as
> a CSV field with the names of each page?
>
> So like:
>
> page-headers:
> Introduction,Gaming,Hardware,Cost,Benchmarks,Overclocking,Final Thoughts
>
> and every time the explode function returns a value instead of assigning 
> it
> the text "next page" it will assign it an index of page-headers?
>
> Then provided that Page 1 is to be taken as an intro, it can spit out the
> ToC at the bottom - or else into a scrolling i-frame at the top-right 
> corner
> of the first page.
>
>
> This "new" method would cover everything mostly, but it's very clunky, so
> I'm looking for suggestions. It makes too many assumptions, and it's not
> intuitive. Having users enter the names of pages as CSVs isn't nice, and
> having the ToC only on the front page most certainly isn't either.
>
> The problem is that solving these can get really ugly really fast. For
> instance, replacing <!--ToC--> with the table of contents would work, but
> how long until new problems come up?
>
> Anyway, just wondering if anyone would be interested in
> a) using such a system - and how many
> b) helping with the code a bit?
>
>
> Most importantly, suggestions for making it more intuitive without adding
> graphical clutter (Ajax ToC creation section?!) and stuff.
>
> Computer Guru
> NeoSmart Technologies
> http://neosmart.net/blog/
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers 



More information about the wp-hackers mailing list