Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2009-09-11 07:54:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: smd_pagicle: automatic (jQuery) pagination of articles

kostas45 wrote:

Say we go to page 3 of articles listing, then to an individual article. If we now click browser’s Back button, we go to page 1 instead of page 3.

Yes, as you say, there’s nothing I can do about this :-(

When you page through stuff it’s really a ‘fake’ page that just divides your whole page into your chosen chunks and then turns divs on and off to display data. All the data has been loaded already to the page and everything you do from that point is client-side trickery. So when you click Back you go to the last real, physically downloaded page in your browser’s history.

Unfortunately, providing javascript history is problematic. The two main ones being:

  1. javascript cannot talk to or intercept the browser’s Back button
  2. javascript has no write access whatsoever to the browser’s history object

Even if we create our own internal js history, visitors would have to use the dedicated Back button inside the web page and not the familiar browser’s Back button. Both of the above restrictions are in place for so-called ‘security’ in our wonderful nanny-state world, and I’m quietly convinced have been the single biggest reason behind preventing AJAX and jQuery being truly useful in this kind of situation.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#26 2009-09-11 08:38:02

kostas45
Member
From: Greece
Registered: 2007-11-08
Posts: 61

Re: smd_pagicle: automatic (jQuery) pagination of articles

Stef, I was thinking somehow using jQuery history plugin

-K

Offline

#27 2009-09-11 08:45:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: smd_pagicle: automatic (jQuery) pagination of articles

kostas45 wrote:

I was thinking somehow using jQuery history plugin

Ah, that’s different. I’m not using hash states but I guess I could if it means we can cheat like that! I’d forgotten about hash states.

The library itself would have to be optional as I don’t want to redistribute the jQuery plugin with this plugin. Leave it with me. When I go hunting for the bug in the new code I’ll see if it’s possible to add this functionality.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#28 2009-09-11 09:03:41

kostas45
Member
From: Greece
Registered: 2007-11-08
Posts: 61

Re: smd_pagicle: automatic (jQuery) pagination of articles

Bloke wrote:

When I go hunting for the bug in the new code I’ll see if it’s possible to add this functionality.

Great news! Thanks a lot Stef :-)

-K

Offline

#29 2009-09-30 12:39:17

Fede
Member
From: BA
Registered: 2009-09-28
Posts: 10

Re: smd_pagicle: automatic (jQuery) pagination of articles

Sorry for the dumb question, but, could this be used for paginating file and links lists ? Im trying to achieve this task without luck

thankyou!

Last edited by Fede (2009-09-30 12:39:54)

Offline

#30 2009-09-30 13:03:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: smd_pagicle: automatic (jQuery) pagination of articles

Fede wrote:

Sorry for the dumb question, but, could this be used for paginating file and links lists

In theory yes, since it’s all jQuery. Just output every item in your list and wrap it in a div. Give smd_pagicle the reference to that div in the element attribute. All you then have to do is inject a break in your list every 5th item via your list form. You could use zem_nth for this, or perhaps smd_if to insert {page} after every 5th item.

Last edited by Bloke (2009-09-30 13:04:28)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#31 2009-11-09 11:21:14

Noxgenus
Member
Registered: 2009-03-12
Posts: 21

Re: smd_pagicle: automatic (jQuery) pagination of articles

damn jquery

can’t we have a mootools one?

Offline

Board footer

Powered by FluxBB