NP_PageBreak - completely (re)done!

Post your new plugins here!
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Re: To quite an extent

Postby Hiro » Tue Sep 07, 2004 6:11 pm

subirghosh wrote:Moraes had initially suggested putting <%pagebreak%> aftter <%body%> in both the short and full templates. This will cause a problem if you don't use pagination uniformly throughout. This is because that would be applying the tag to the Body element of all stories.


Infacts, I changed <body with <more.

So the <%pagebreak%> tag must be in the full template only i.e. apply it only to the Extended section. What Hiro did was to make it work by using the body as a teaser. One can make it work that way, but again... the logic will have to apply all stories.

Perhaps Moraes when you get your comp back, you can release the final and perfect version :lol: :D


I know all that, and Rodrigo knows too; it is the main prob behind the plugin's system. But I guess he'll be successful (can anyone help him a bit?). This is one of most useful Nucleus' plugins.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Re: To quite an extent

Postby moraes » Tue Sep 07, 2004 6:22 pm

subirghosh wrote:So the <%pagebreak%> tag must be in the full template only i.e. apply it only to the Extended section. What Hiro did was to make it work by using the body as a teaser. One can make it work that way, but again... the logic will have to apply all stories.

My first idea was to allow the <%pagebreak%> tag both in the default and the full templates, and the pagebreaks in the body and the extended parts. The initial version didn't work in the extended part, but this is easy to implement, as commented in the code and later made by Hiro. Of course people will be free to use it in just one of the templates, depending on how it will be used. Also, some will prefer to add pagebreaks in the body text, others in the extended text, others in both. I don't guess why, I only want it as flexible as it can be.

m.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Wed Sep 08, 2004 3:12 am

Version 0.2 is out there! Now each page can have its own title. Titles will be used in the page navigation instead of default numbering. :-D

Get the improved code here at the wiki:
http://wakka.xiffy.nl/PageBreak

You have to uninstall/reinstall the plugin, because some plugin options were added: you can edit the start & end tags that will be used in the page titles (default is <h2> & </h2>).

The first line of each page, if not empty, will be used as the item title. To test it make an item with this content:

Code: Select all

Title 1
page 1 content
page 1 content
page 1 content
<%pagebreak%>Title 2
page 2 content
page 2 content
page 2 content
<%pagebreak%>Title 3
page 3 content
page 3 content
page 3 content

Suggestion: put <%PageBreak%> inside a floated div in your template(s), so the page navigation will be placed in a small box in the top of each page/item part.

History
v 0.2:
* Added page title to each page! First line of each page will be the title - if first line is empty, numbers will be used;
* Fixed bug: pagination appeared even on posts without <%pagebreak%>;
* Current page has no link in the list anymore;
* Added <ul> and <li> to the navigation links (easy customizable with css);
* Added page breaks on extended parts (thanks, Hiro!).
* More with less: improved code to deal with body and extended item parts.
v 0.1b - Initial release: basic functionallity is done.
TODO: FancyURL compatibility, next/previous links and some cosmetic improvements.

enjoy! :-D
moraes
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Wed Sep 08, 2004 9:27 am

nice job Rodrigo.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Wed Sep 08, 2004 1:18 pm

version 0.3:
- fixed unwanted behavior: when using no title, a <h2><br /></h2> was added in the beginning of the page, resulting in a blank line. Now nothing appears.
Here it is: http://wiki.nucleuscms.org/PageBreak

Notes:
* First line of the first page should be blank if no title is used. Following page titles should come right after the <%pagebreak%> tag.
* So each <%pagebreak%> should be placed in its own line, followed or not by a title.
* If a title is provided, page links will use the title, if not, they will appear as "page 1", "page 2" etc

Take a look at this devshed tutorial navigation ("Article Index"). This is what NP_PageBreak can do for you! ;-)

m.
User avatar
subirghosh
Posts: 408
Joined: Wed Aug 25, 2004 11:39 am
Location: Delhi, India
Contact:

Postby subirghosh » Wed Sep 08, 2004 7:44 pm

Wow Rodrigo! That was fast :D

I am in the middle of something else altogether, or I would have tried it out right away. Soon enough I will.

:)
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Thu Sep 09, 2004 12:08 am

This is a great progress
This is what I meant as for evolving towards a comprehensive *publishing* system, not yet something that's a cms or a blog software either, if we should pursue something unique. Hope we'll follow this track; I guess there's a long road to beat until then. Surely we urge a complex enseble's collaboration.

p.s.; ty for citing me in the wiki, Rodrigo, nice of you. Though, sincerely I really didn't anything special to deserve it :)
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Thu Sep 09, 2004 12:24 am

Hiro wrote:This is what I meant as for evolving towards a comprehensive *publishing* system, not yet something that's a cms or a blog software either

You mean, the mentioned devshed article?

m.
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Thu Sep 09, 2004 12:32 am

Nope: I meant the results you obtained in improving your script.
Achieving an output like the one of the sample article, it is undoubtfully a great step ahead.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Thu Sep 09, 2004 1:08 am

Hiro wrote:Achieving an output like the one of the sample article, it is undoubtfully a great step ahead.

It's almost done. Now the problem is how to set templates & css to achieve that output, since the plugin already make a similar navigation between pages, except by the "next" link (coming soon ;-)).

m.
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Thu Sep 09, 2004 1:55 am

uhu, agree. I'm still testing it so far, and whilst I can say that in sum the result is great, maybe there's something which degradate the output.
Pratically, maybe it should be better to use an *external* embed (such as <%PageBreakList%>) to show the items anywhere (eg, in the single article skin part), not yet within the detailed template only (unless one have it within some complex nested tables).
Maybe your original intuition about inserting the title as %pagebreak(title)% were much more fittingly; otherwise, just think up that people must revisionate *all* the articles formatted using the precedent version of the plugin! And it where better if the script will include automatically the main title for the first page, instead of putting a carriage for having a blank "page1".
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Thu Sep 09, 2004 7:20 am

Hiro wrote:Maybe your original intuition about inserting the title as %pagebreak(title)% were much more fittingly; And it where better if the script will include automatically the main title for the first page, instead of putting a carriage for having a blank "page1".

I agree it is not very elegant to have the titles outside any tags, but I couldn't think a better solution. I thought about using <%pagebreak(title)%>, as initially mentioned, but maybe this would be inconsistent since page 1 would have to use it differently. Since page 1 doesn't have its own tag <%pagebreak%> (or maybe <%pagebreak(title)%>), where people would put the title? So I came up with the first line (which is also easier to implement and quickier to parse :)).

Some thoughts:
* I though aout "killing" page 1 title, but this wouldn't be *the* solution, since these page titles I'm talking about are, in fact, subtitles. The main item title will appear on every page, as the "article title", followed by the "chapter" name (the subtitle). Got the idea? So I don't think it would be good if page 1 just didn't have its own name (even if it is "Introduction").

* About past versions of the plugin and the items that already use it, I'm sorry. I won't try to fit new versions to the ones that were partially implemented before. I'm trying to find a good solution for this plugin, and probably the early items that already use it will have to be adapted. :(

so, do you have any idea about all of this?

m.
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Thu Sep 09, 2004 9:57 am

And it where better if the script will include automatically the main title for the first page, instead of putting a carriage for having a blank "page1".


Read it in this way: the plugin automatically must understand that the "bulk" article's title is the first title it must catch & show in the list, as I guess it happens as for the devshed sample. I guess this might solve your question
Since page 1 doesn't have its own tag <%pagebreak%> (or maybe <%pagebreak(title)%>), where people would put the title?


moraes wrote:so, do you have any idea about all of this?


Yes, I have it, and you already know what it is: that is, some indispensable plugins (first off, this one) should be integral part of the publishing core. I guess we *urge* some kind of consultation about the problems we constantly face with issues like these.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Thu Sep 09, 2004 2:54 pm

Hiro wrote:Read it in this way: the plugin automatically must understand that the "bulk" article's title is the first title it must catch & show in the list, as I guess it happens as for the devshed sample.

Ok, I will do it. And implement <%pagebreak()%>

Hiro wrote:I guess we *urge* some kind of consultation about the problems we constantly face with issues like these.

That's why we have plugins. :lol: Since its release, 2 persons have manifested interest in this plugin. It will be useful for some more people, but this doesn't mean it should be part of the core. Personally I like very much the idea of this functionallity, but I don't think it should be part of the core. :roll: Take it easy. You will have it working the way you really want - as a nice plugin. ;-)

m.
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Thu Sep 09, 2004 4:10 pm

moraes wrote:That's why we have plugins. :lol: Since its release, 2 persons have manifested interest in this plugin. It will be useful for some more people, but this doesn't mean it should be part of the core. Personally I like very much the idea of this functionallity, but I don't think it should be part of the core. :roll: Take it easy. You will have it working the way you really want - as a nice plugin. ;-)
m.

I take it very easy, Rodrigo. The fact that I struggle for a perfect Nucleus, might demonstrate it, albeit I might seem stark. But I rest anyway in my opinion: plugins like this and some others more should be part of the elaborative system.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Fri Sep 10, 2004 5:26 pm

Ok, here it goes. NP_PageBreak was completely rewritten and now is closer to what we dreamed with. I hope so! ;-)

Get version 0.4: http://wiki.nucleuscms.org/PageBreak

And here's the news:
Following Hiro's suggestion, titles are now included inside the pagebreak tag: <%pagebreak(Here's a title!)%>. Much more convenient and consistent, since now we can decide if the first page will have a title:

Code: Select all

<%pagebreak(page 1 title)%>
page 1 content
page 1 content
<%pagebreak(page 2 title)%>
page 2 content
page 2 content
<%pagebreak(page 3 title)%>
page 3 content
page 3 content

...or not:

Code: Select all

page 1 content
page 1 content
<%pagebreak(page 2 title)%>
page 2 content
page 2 content
<%pagebreak(page 3 title)%>
page 3 content
page 3 content

The script will take care of the rest. Just try it. ;-)

version 0.4 changelog:
* titles are added using <%pagebreak(title)%> anywhere (first page can have its own title or not);
* navigation links are placed inside a customizable div that only appears when there are page breaks, so you can make it floats;
* fancy url's compatibility;
*added new options (reinstall the plugin to see them):
- custom error message when trying to access a non-existent page
- show numbers before navigation links?
- navigation links start tag (default: <div class="pagebreak">)
- navigation links end tag (default: </div>)
TODO: next/previous page links

have fun! :-D
moraes
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Fri Sep 10, 2004 7:14 pm

Ok, I'll be your prime tester :)
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Fri Sep 10, 2004 7:37 pm

One more thing! Version 0.5 adds a "next page" option to be used in templates. The wiki was updated.

These are the template codes:
* Create navigation links

Code: Select all

<%PageBreak(links)%>

* Create a link to the next page using its title

Code: Select all

<%PageBreak(next)%>


The next link was the missing feature to allow multi-page items like this devshed 's tutorial. ;-)

m.
User avatar
moraes
Nucleus Guru
Nucleus Guru
Posts: 2377
Joined: Sun Dec 23, 2001 9:42 pm
Location: Curitiba, Brazil
Contact:

Postby moraes » Sat Sep 11, 2004 5:14 am

version 0.6:
* bug fix: navigation was added even on items with no page breaks. :oops:
* added option: div for the next link.

here it is: http://wiki.nucleuscms.org/PageBreak

m.
Hiro
Posts: 419
Joined: Tue Aug 03, 2004 2:36 pm
Location: Italy
Contact:

Postby Hiro » Sat Sep 11, 2004 10:32 am

That's astounding, Rodrigo!
I'll implement asap, when I've solved the current site's issues I'm facing.

ps., what's about a system of voting, in the wiki, for the most useful plugins? :)

Return to “Plugin Development”