View Full Version : Ajax Pagination - More than one objects per page

08-25-2008, 12:24 PM
1) Script Title: Ajax Pagination script v1.2

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

3) Describe problem: I want to have more than one objects in each page, which looks like this:





1 2 3 next





1 2 3 next

How can I change the number of the html files that are loaded in each page??

08-25-2008, 04:33 PM
Hmm I'm not sure I fully understand. Do you simply mean you want to display multiple instances of Ajax Pagination script on a page?

08-26-2008, 06:38 AM
yes that's it, I changed the description a little to make it easier to understand. can you describe me how to do it? Is it possible?

I really need to do this, because the script is useless for me if it shows one element per page.

08-26-2008, 04:58 PM
The script certainly does support multiple instances of itself on the same page. Simply make sure all variable names used by each instance are unique. Here's the HTML code for 2 separate instances of the script:

<h2>Example 1</h2>

<div id="paginate-top"> </div>
<div id="bookcontent"> </div>
<div id="paginate-bottom"> </div>

<script type="text/javascript">

var bookonflowers={
pages: ["demofiles/flower.htm", "demofiles/flower2.htm", "demofiles/flower3.htm", "demofiles/flower4.htm"],
selectedpage: 0 //set page shown by default (0=1st page)

var mybookinstance=new ajaxpageclass.createBook(bookonflowers, "bookcontent", ["paginate-top", "paginate-bottom"])


<h2>Example 2</h2>

<div id="paginate-top2"> </div>
<div id="bookcontent2"> </div>
<div id="paginate-bottom2"> </div>

<script type="text/javascript">

var bookonanimals={
pages: ["demofiles/external.htm", "demofiles/external2.htm", "demofiles/external3.htm"],
selectedpage: 0 //set page shown by default (0=1st page)

var mybookinstance2=new ajaxpageclass.createBook(bookonanimals, "bookcontent2", ["paginate-top2", "paginate-bottom2"])


08-27-2008, 07:07 AM
Maybe I didn't describe it well enough, I think that you didn't understand exactly. I dont need the script to have 2 instances in my page but one. That one script should just show 4 flowers of my list of external pages, then the next 4 flowers etc.

Ok, let's say I create a list of flowers. Each flower in my list is one external html file.

var bookonflowers={
pages: ["flower1.htm", "flower2.htm", "flower3.htm", "flower4.htm","flower5.htm", "flower6.htm", "flower7.htm", "flower8.htm","flower9.htm", "flower10.htm", "flower11.htm", "flower12.htm"],
selectedpage: 0 //set page shown by default (0=1st page)

the script should create 3 pages for my list, with 4 external html files loaded in each page:
the first page should have the flowers 1-2-3-4,
when I request to see the second page of results in the pagination menu (1,2,3, next), I should get the second page of results which contains flowers 5-6-7-8

http://img525.imageshack.us/img525/5855/20704550km7.th.jpg (http://img525.imageshack.us/my.php?image=20704550km7.jpg)

08-27-2008, 08:19 AM
Ah I see what you mean now. Unfortunately there's no easy way to do this without some rather extensive changes to the script. Might be something you'd want to consider posting in the "DD scripts Paid Help (http://www.dynamicdrive.com/forums/forumdisplay.php?f=29)" section.

08-27-2008, 08:34 AM
I just found the Virtual Pagination Script (http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm). The code of Demo 3 works fine for me, although it does not load dynamically content, but it gives an automatic way to publish content in several pages.

I am sorry if I confused you with my bad descriptions. I am very happy that I found Virtual pagination and I dont need to mess up with javascript code. Thank you very much for your help. You are very kind :)