So I have implemented AJAX Pagination to my site however I am not getting the desired results.
This is the snippet of code on my index page to include the embed
<div class="well"> <h3>Recently Paid IOU's</h3>
{embed="embeds/recent_ious" member_id="<?php echo $member_id ?>"}
</div>
This is the embed file which is located in system/expressionengine/templates/default_site/embeds.group/recent_ious.html
{exp:ajax_pagination:wrapper ajax_container="ajax_container" embed_template_url="{homepage}/embeds/recent_ious/" xid_element_id="infinite_scroll_xid" process_indicator="process_indicator" process_indicator_scroll="yes" parse="inward" }
{ajax_pagination_container_top} <div id="ajax_container"> {/ajax_pagination_container_top}
<input type="hidden" id="infinite_scroll_xid" value="{XID_HASH}"> <input type="hidden" name="csrf_token" value="{csrf_token}">
<div class="process_indicator"> Loading… </div>
{exp:query limit="5" sql= "SELECT field_id_4, member_id, username, screen_name, SUM(`field_id_9`) `total` FROM (SELECT * FROM (SELECT field_id_4, field_id_9 FROM exp_channel_data WHERE field_id_5='1' AND field_id_13='1' UNION ALL SELECT field_id_5, field_id_9 FROM exp_channel_data WHERE field_id_4='1' AND field_id_13='1') AS A JOIN (SELECT * FROM exp_members) AS B ON A.field_id_4=B.member_id ) AS C GROUP BY member_id ORDER BY screen_name ASC"}
{exp:member:custom_profile_data member_id='{field_id_4}' dynamic="no" style="display:inline;"} <p> {if {total} > 0} I paid {screen_name} ${total} {/if}
{if {total} < 0} {screen_name} paid me ${exp:math formula="{total}*-1" decimals="2"} {/if}
{if {total} == 0} I owed {screen_name} the same amount he/she owed me. The debt was cleared!</p> {/if} </p>
{/exp:member:custom_profile_data}
{paginate} {exp:ajax_pagination:links} <ul class="pager" style="display:block;"> {if previous_page} <li class="previous pull-left" style="display:inline-block;"><a href="{auto_path}">← Older</a></li> <p style="display:inline-block;">Page {current_page} of {total_pages} pages </p> <li class="next disabled pull-right" style="display:inline-block;"><a href="{auto_path}">Newer →</a></li> {/if} {if next_page} <li class="previous disabled pull-left" style="display:inline-block;"><a href="{auto_path}">← Older</a></li> <p style="display:inline-block;">Page {current_page} of {total_pages} pages </p> <li class="next pull-right" style="display:inline-block;"><a href="{auto_path}">Newer →</a></li> {/if} </ul> {/exp:ajax_pagination:links} {/paginate}
{/exp:query}
{ajax_pagination_container_bottom} </div> {/ajax_pagination_container_bottom}
{/exp:ajax_pagination:wrapper}
I have read that EE won’t allow access to system, therefor access to templates, via the URL.
However when i go directly to http://localhost:8888/index.php/embeds/recent_ious in the URL it returns what would be the first page of results. Then if i go to http://localhost:8888/index.php/embeds/recent_ious/P5 in the URL it returns what would be the second page of results.
In chrome I am running console and the error i receive when I click the ‘next page’ button looks like this
POST http://localhost:8888/index.php/embeds/recent_ious/P5 403 (Forbidden)
ajaxPagination1.fetch
Data onclick
The problem here is that the POST function isn’t able to grab the contents from the recent_ious embedded file.
Attached are images of the site and the popup i receive when i try to go to the next page of posts.
ANY help would be much appreciated. I can attach files as needed too.
|