View Full Version : help needed with Virtual Pagination in dynamic pages

04-23-2007, 01:42 PM
1) Script Title: Dynamic Ajax Content & Virtual Pagination Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem: i've used the virtual pagination script together with the Dynamic Ajax Content but i can't make them work together: when i load some dynamic content (from a mysql db using php) in a div with the ajaxcombo function nothing happens. It's like if the loaded page can't invoke the function to activate the pagination.

Is it possible to call a function loaded via ajax?

This is the page i'm worknig on:


thanks vitto

04-23-2007, 07:41 PM
In their present states it's difficult to get the two to work together. The Virtual Pagination script is meant to paginate content already on the page. An easier and better approach IMO is to simply use PHP to output all the content when the page loads, but segmented using the Virtual Pagination script (just wrap each piece of content in its special DIV). To the end user, he/she will still only see one piece of content at a time, and can paginate between contents.

04-24-2007, 09:32 AM
i managed to make them work. The basics are as you said but i still need to make the php work, which is not up to me. I'll see in the next days and eventually i'll post my solution, it could be useful.


04-24-2007, 01:01 PM
no i got another little problem...:)
i'd like my pagination links stop when they reach the last div and not to show the contents all over again. What could i do?

04-24-2007, 07:30 PM
Regarding getting the "Previous" and "Next" pagination links to not wrap, just find the lines:

if (keyword=="previous")
this.currentpage=(this.currentpage>0)? this.currentpage-1 : (this.currentpage==0)? this.pagecount-1 : 0
else if (keyword=="next")
this.currentpage=(this.currentpage<this.pagecount-1)? this.currentpage+1 : 0

inside the .js file, and change it to:

if (keyword=="previous")
this.currentpage=(this.currentpage>0)? this.currentpage-1 : 0
else if (keyword=="next")
this.currentpage=(this.currentpage<this.pagecount-1)? this.currentpage+1 : this.pagecount-1