PDA

View Full Version : Anyone up for this one? Dynamic Ajax Content Problem.



PaleRider
05-06-2008, 12:50 AM
1) Script Title: Dynamic Ajax Content

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

3) Describe problem: The script works amazingly well, but a php file it loads in the content area tends to "break out" and open a new page if there are "next page" or "previous page" links within. Is there a way of modifying the Ajax Content script OR the php file it calls upon to prevent this "breakout" from occurring?

See how the script is implemented here ->http://www.commentcollective.com

The php script it calls upon does have the ability to display a set amount of images per page but I currently have it set to display all images in a category because of this breakout problem. If anyone could point me in the right direction to solving this problem it would be greatly appreciated. I would love to set the number of images displayed per page to 10 or so to keep the folks with slower connection speeds happy.

I have combed this site rather extensively for an answer to this problem and have seen one or two others that are experiencing the same difficulties, but I have not found a solution in any answers that have been given. I can supply a sample of the php script if necessary.

Thanks in advance .... PR

TimFA
05-06-2008, 01:38 AM
Are the links formatted like:



<a href="javascript:ajaxpage('test.htm', 'contentarea');">test</a>


Or are they just normal links? If they are normal links, then just convert them to the above way. If not then please provide an example/explain better, or post your code.

Tim

PaleRider
05-06-2008, 02:33 AM
Are the links formatted like:



<a href="javascript:ajaxpage('test.htm', 'contentarea');">test</a>


Or are they just normal links? If they are normal links, then just convert them to the above way. If not then please provide an example/explain better, or post your code.

Tim
Yes, the links are formatted as above and the "test.php" file loads into the content area as it should. But when a "previous page" or "next page" is clicked in the dynamic content area the breakout occurs.

Please feel free to visit the link posted above and view the source if necessary. I really appreciate your quick reply.

PR

jscheuer1
05-06-2008, 05:03 AM
I don't think you understood what TimFA is saying. The links in the content area. The things that you click on to load next and previous from within the content area. Unless they are calls to load content into the content area, then of course the entire page would change.

And, from what I understand, we can't see those links or their code because you are having the pages that load into the content area display the full page, instead of only a portion of their content.

PaleRider
05-06-2008, 09:36 AM
I don't think you understood what TimFA is saying. The links in the content area. The things that you click on to load next and previous from within the content area. Unless they are calls to load content into the content area, then of course the entire page would change.

And, from what I understand, we can't see those links or their code because you are having the pages that load into the content area display the full page, instead of only a portion of their content.

My apologies, I did misunderstand. It was late and I had a rough Monday at work. The php script code is displayed below in it's entirety. Any help in implementing the
http://javascript:ajaxpage into this below would be great.


As you can see, the "previous" and "next" links are set to display at the top and bottom of the dynamically generated content if a set number of images is reached. This set number is currently set at 1000 to avoid the breakout problem.

Thanks again folks .... PR

jscheuer1
05-06-2008, 03:31 PM
This is the kind of link that is 'breaking out':


echo '<td align="left" width="38%"><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $pre . '"><b>Previous Page</b></a></td>';

My PHP isn't the best, and I am taking TimFA's word for the javascript part, but I think if you made them all something like:


echo '<td align="left" width="38%"><a href="javascript:ajaxpage(\'' . $_SERVER['PHP_SELF'] . '?page=' . $pre . '\', \'contentarea\');"><b>Previous Page</b></a></td>';

It should all work out.

PaleRider
05-06-2008, 08:07 PM
This is the kind of link that is 'breaking out':


echo '<td align="left" width="38%"><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $pre . '"><b>Previous Page</b></a></td>';

My PHP isn't the best, and I am taking TimFA's word for the javascript part, but I think if you made them all something like:


echo '<td align="left" width="38%"><a href="javascript:ajaxpage(\'' . $_SERVER['PHP_SELF'] . '?page=' . $pre . '\', \'contentarea\');"><b>Previous Page</b></a></td>';

It should all work out.

Thank you very much, this seems to have totally solved the breakout problem. I had tried several variants of the code you supplied, but had never nailed in spot on like you did. You say you php skills aren't the best, but they are definitely better than mine. :)

If you are interested in seeing it in action go to http://www.commentcollective.com/index2.html and use the "Test" link in the Miscellaneous category on the left hand menu.

Once again ... Thanks so much ... PR

TimFA
05-07-2008, 02:10 AM
Glad you got it fixed, man. Happy coding...

Tim