PDA

View Full Version : Ajax Pagination 1.2 with Inline Content



purpleindigo
09-29-2008, 11:27 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 would like Google and other search engines to crawl the first page of content from the pagination.

Is it possible for the first page of the pagination script to be inline content, and for pages 2 and up to be ajax content retrieved from other webpages?

Thanks

ddadmin
09-30-2008, 06:01 PM
Hmm not easily unfortunately. What you can do if you want the first page's content to be crawl-able is to add that content within the content DIV to start, hidden via CSS. Something like:


<div id="bookcontent">
<div style="display="none">
First page content replicated here
First page content replicated here
</div>
</div>

This content will be overwritten when the script initializes, though that makes no difference to the search engines.

purpleindigo
09-30-2008, 10:14 PM
thanks. I'd prefer not to increase the load time which that will do though.

Can I change the script so it does something like the ajax tab script does for inline content?

http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

ddadmin
10-01-2008, 08:15 AM
It's certainly possible, though since it requires changes in quite a few places, I may not be able to help come up with the changes due to my schedule. Another solution btw is just to include a link to the first external content within the DIV:


<div id="bookcontent">
<div style="display="none">
<a href="page1.htm">Page 1</a>
</div>
</div>

That lets search engines crawl the external page while avoiding the extra bandwidth issue.

purpleindigo
04-10-2009, 12:47 PM
Is there any way of using what you said to make the inline content load, but tell the script to just "not work" when page 1 is selected, so it doesn't get hidden?

Or can you suggest any freelancers I can hire to do this?

ddadmin
04-11-2009, 05:31 AM
Well, getting the first page to not work/load at all is very simple. Inside the .js file, find the following code, and add to it the code in red:


selectpage:function(selectedpage){
if (selectedpage==0)
return

purpleindigo
04-11-2009, 10:38 AM
That unfortunately seemed to kill the whole script, not just the first page.

I tried changing the following (new text in red)

if (this.pageinfo.pages.length>0 && selectedpage>0){
var ajaxfriendlyurl=this.pageinfo.pages[selectedpage].replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
ajaxpageclass.connect(ajaxfriendlyurl, this.divId) //fetch requested page and display it inside DIV
}
which worked when the page was initially loaded, but when you click to the second page and return to the first page, it won't clear the content.


Then I thought I could maybe insert an extra DIV to only be visible when the first page is selected

<div id="paginate-top"> </div>
<div id="bookcontent"> </div>
<div id="basiccontent">This is the original content for page 1 </div>
<div id="paginate-bottom"> </div>

and somewhere in the javascript put

if (selectedpage==0){
document.getElementbyId('bookcontent').style.display = "none"
document.getElementbyId('basiccontent').style.display = ""
}
if (selectedpage>0){
document.getElementbyId('bookcontent').style.display = ""
document.getElementbyId('basiccontent').style.display = "none"
}

but this seemed to just kill the javascript entirely, or do nothing at all, depending on where I put it in the script.

Is there something wrong with my final bit of code (I really don't know javascript much) or is there a specific place I can put it where it should work?

ddadmin
04-11-2009, 11:12 AM
The code I posted should work. Here is the modified .js file in case you've made a mistake.

purpleindigo
04-11-2009, 11:40 AM
I switched paginate-persist to false so that it's easier to test.

It works when you first open up the page, but if you go to the next page and then go back to page 1, it won't update

ddadmin
04-12-2009, 12:34 AM
As far as I can see the mod is behaving properly actually. That is, when the page first loads, the 1st page of the script isn't loaded (allowing you to show your own content statically added to the page). Then when you click on Page 2 (which loads that btw) and then back to Page 1, that page again isn't loaded, leaving Page 2's content on the page.

Perhaps what you're asking is, in addition to the above, to have Page 1 also erase any content loaded by the script?