Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL structure for the nextSelector link #5

Closed
Pewpewarrows opened this issue Oct 18, 2010 · 13 comments
Closed

URL structure for the nextSelector link #5

Pewpewarrows opened this issue Oct 18, 2010 · 13 comments

Comments

@Pewpewarrows
Copy link

This isn't necessarily functionality-related, but a coworker of mine this morning had a difficult time getting the plugin working until he realized that the URL passed to the nextSelector has to pass a specific regex in order for the plugin to operate as intended. Specifically in the determinePath function, it's literally looking for a url that has some sort of number representing the next page (i.e., '/page/2/' or 'page=2'), as opposed to what he was doing which was the starting item # (like 'start=51').

I think if the documentation on the project website had just a sentence describing what the URL must contain in order for it to function properly, that'd clear things up a lot. And please ignore this ticket if that sentence is there already, but I couldn't find it after a quick read-through of http://www.infinite-scroll.com/infinite-scroll-jquery-plugin/

@paulirish
Copy link
Contributor

Hey pewpew,

This is true.. I think we could do two things...

  1. add docs to that page that clarify this
  2. add an option to the plugin that allows you to specify exactly how to parse and increment the URL.

I'd love your help with either. Could I set you up with access to the site?

@gercheq
Copy link

gercheq commented Oct 26, 2010

omg! I should have read this issue before diving into the source code... It would be better if the loading mechanism simply worked with a link that exist in each page. Then, it'd be possible to integrate this plugin without worrying about the url structure. There might be many cases where it is not possible to modify the URL (ie. large media organizations using static publishing).

@paulirish
Copy link
Contributor

gercheq, so the plugin does its best to guess what the story with the URL structure is.

that way you dont have to specify
but there are cases where you'd want to specify.

and thus... this ticket :)

@Pewpewarrows
Copy link
Author

Paul,

I'd definitely be happy to help with it! Let me kick around a few ideas today and I'll post back here with them.

@paulirish
Copy link
Contributor

@samcleaver
Copy link
Contributor

Can we close this issue now Paul? It seems you can define your own path details.

@Cipa
Copy link

Cipa commented Feb 6, 2011

Hi,
I think I am missing something regarding Frank's comment

"Here is a patch to the jquery version which does not try to guess/calculate the next page, but actually reads it from the the next link from the content returned from ajax. "

Is there something I need to do in my config?

My next links look like
<a href='/infinite?start=5' class='ditto_next_link'>Next ></a>

<a href='/infinite?start=10' class='ditto_next_link'>Next ></a>

Is there a config option that activates reading the next page in order to get the link?

Thanks

@lukeshumard
Copy link
Contributor

there is. you can use pathParse option now to define how the plugin reads your page structure. i'll try and get a demo of this for the new site.

@Cipa
Copy link

Cipa commented Feb 9, 2011

I made my own modifications at https://github.com/Cipa/infinite-scroll
I basically added support for MODX CMS with Ditto. I tried pathParse but without luck.

The thing I could not make, is get the IS page counter inside pathParse as a global variable. Basically the first next link specifies the number of items per page, so I have to save it somehow and reuse it by multipling it with the page number

Maybe it's possible with the current code but I might have missed something

@finsterdexter
Copy link

This pathParse needs some documentation. What, exactly, is supposed to be passed to pathParse?

@lukeshumard
Copy link
Contributor

pathParse should be a function. There will be new documentation coming soon!

@lukeshumard
Copy link
Contributor

To clarify further, pathParse should be a function that returns your path, which is an array of what goes before and after your next page number.

For example, if your next page url is /page/2/, pathParse should return ['/page/','/']. If your next page url is index2.html, pathParse should return ['index','.html'].

@lukeshumard
Copy link
Contributor

Nope, totally closed...unless someone else wants to add something to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

7 participants