Plugin

Developer
Supported

Infinite Scroll

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Laisvunas

     

You must be logged in to post.

Error Message when clicking More

Support Request

richk82
richk82

Hi there

I’ve just purchased and set up the Infinite Scroll plugin, all without any hitches and it’s pretty simple to get your head around.  However when I click the more link to display the next three items I want displayed I get the following error message appear in it’s place…

-1) { var s = source.indexOf(”“, e); // Add to scripts array scripts.push(source.substring(s_e+1, e)); // Strip from source source = source.substring(0, s) + source.substring(e_e+1); } //alert(‘scripts.length: ’ + scripts.length); // Loop through every script collected and eval it for(var i=0; i

... The next three items do appear, but after that when I click the more link again it fails to load the next items and I just get the process indicator constantly displaying.

Has anyone else experienced this problem? What am I missing?  Any help will be greatly received.


Many thanks in advance
Rich


FYI here is the code of my embeded infinite scroll template…

{exp:infinite_scroll:wrapper
    embed_template_url
="{site_url}/news/infinite-scroll"
    
ajax_container="ajax_container"
    
process_indicator="process_indicator"
    
next_chunk_link="more-news"
    
parse="inward"}

    {infinite_scroll_container_top}
    
<div id="ajax_container">
    
{/infinite_scroll_container_top}

        {exp
:channel:entries channel="news" limit="3" orderby="date" sort="desc" paginate="bottom" parse="inward"}

        
<li>
            <
h1><a href="{title_permalink=">{title}</a></h1>
            <
span class="date">{entry_date format="%j%S %F %Y"}</span>
            <
p>{exp:eehive_hacksaw words="50" append="..."}{news_text}{/exp:eehive_hacksaw}</p>
            <
class="button" href="{title_permalink=">read more</a>
        </
li>

        
{if count == total_results}
        
<div class="process_indicator">Loading...</div>
        
{/if}

        {paginate}{exp
:infinite_scroll:next_chunk_link}{if next_page}<div class="more-news">
            <
a href="{auto_path}">more news</a>
        </
div>{/if}{/exp:infinite_scroll:next_chunk_link}{/paginate}

        {
/exp:channel:entries}

    {infinite_scroll_container_bottom}
    
</div><!-- End of #ajax_container -->
    
{/infinite_scroll_container_bottom}

{
/exp:infinite_scroll:wrapper} 

 

Laisvunas
# 1
Developer
Laisvunas

Hi Rich,

Please, post here URL of your main template.

richk82
# 2
richk82

Hi there

This is the code for my main template that infinite scroll is mean to work on…

{if segment_2 == ""}

    {embed
="inc/header" page_title="Comment"}

    
<div id="container" class="no-header-img">        
        
{embed="inc/commentSidebar"}
        
        
<div id="content-sidebar">
            <
ul id="news">

                
{embed="comment/infinite-scroll"}

            
</ul>
        </
div>
        <
div class="clear"><!-- --></div>
    </
div>
    
    <
div class="clear"><!-- --></div>

{if:else}

    {embed
="inc/header" page_title="{exp:channel:entries channel="comment" limit="1"}{title}{/exp:channel:entries}"}

    
<div id="container" class="no-header-img">        
        <
div id="sidebar">
            <
ul id="archive" class="latest-news">

                <
li class="title">Latest Comment</li>
                
                
{exp:channel:entries channel="comment" limit="6" orderby="date" sort="desc" dynamic="no"}

                
<li><a href="{title_permalink=">{title}</a><span class="date">{entry_date format="%j%S %F %Y"}</span></li>
                
                
{/exp:channel:entries}
                
            
</ul>
        </
div>
        
        <
div id="content-sidebar" class="news-single">
            
            
{exp:channel:entries channel="comment" limit="1"}
            
            
<h1>{title}</h1>
            <
span class="date">{entry_date format="%j%S %F %Y"}</span>
            
{news_text}
            
            {
/exp:channel:entries}

        
</div>
        <
div class="clear"><!-- --></div>
    </
div>
    
    <
div class="clear"><!-- --></div>

{/if}

{embed
="inc/footer"

And here is the actual page on the production server that I would like it to work on > http://mc.lh.gs/comment  If you click “more comment” at the bottom of the page you’ll see the error.

Many thanks
Rich

Laisvunas
# 3
Developer
Laisvunas

Hi Rich,

I tried your code and found that it works correctly on my server. You can see it here.

I cannot fix this issue without a case to work on. Maybe you can give me EE CP and FTP access to your dev server? If you can, send me login details to this email address: saugos [at] gmail [dot] com

richk82
# 4
richk82

Hi there

Thanks, I’ll drop you an email shortly.

Many thanks
Rich

srelias
# 5
srelias

Experiencing this exact problem.

Laisvunas- I sent you an email stating as much along with a screenshot. Will provide access to site once I get confirmation from you that you are still actively supporting this plugin and this particular issue.

richk82- would greatly appreciate a private ping or if you could post your solution here if at all possible.

Thanks!

richk82
# 6
richk82

Hi srelias

Sorry to hear you were experiencing the problem, it was most frustrating.

Unfortunately I didn’t actually come up with a fix.  Not long after I posted this thread I had to hand the project over to another developer I work with due to other work commitments, they managed to get the functionality working on the site but I don’t believe they used this Infinite Scroll plugin.  I think they wrote their own Ajax.

When speaking to Laisvunas over the emails late last year I got the following reply…

I investigated the issue and found that when Infinite Scroll fetches the new chunk of data from embed template the $_POST array for some reason is empty.  $_POST array should contain at least variable “is_ajax”.

Apologies I can’t help you further. Hopefully Laisvunas will be able to shed some light on it…

Take care

Rich

srelias
# 7
srelias

richk82,

You’re awesome! Thanks for taking the time out to help in any way you can. Still looking forward to a response from Laisvunas but your insight may help me head him off at the pass while waiting.

Thanks again!

richk82
# 8
richk82

No problems. All the best with finding a fix…

Rich

srelias
# 9
srelias

Update: Solution

For those encountering this issue in the future…

Turns out the .htaccess configuration was causing the trouble. For SEO purposes we typically default to certain .htaccess “settings” which are pretty universal for most of our EE projects. For this project however we discovered that forcing a trailing slash to paths without an extension were causing the AJAX mishap. We simply commented out the following:

# Remove the trailing slash to paths without an extension
# Uncomment to activate
# RewriteCond %{REQUEST_URI} /$
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.+)/$ $1 [L,R=301]

ACER OS
# 10
ACER OS

I am having the same issue. When clicked More link below appears before the next set of entries

-1) { var s = source.indexOf(”“, e); // Add to scripts array scripts.push(source.substring(s_e+1, e)); // Strip from source source = source.substring(0, s) + source.substring(e_e+1); } //alert(‘scripts.length: ’ + scripts.length); // Loop through every script collected and eval it for(var i=0; i


Below is alreadycommented out in .htaccess
# Remove the trailing slash to paths without an extension
# Uncomment to activate
# RewriteCond %{REQUEST_URI} /$
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.+)/$ $1 [L,R=301]

Can it be anything else?

adam.kolinski
# 11
adam.kolinski

I also am having the same issue.

.htaccess solution has been tried

-1) { var s = source.indexOf(”“, e); // Add to scripts array scripts.push(source.substring(s_e+1, e)); // Strip from source source = source.substring(0, s) + source.substring(e_e+1); } //alert(‘scripts.length: ’ + scripts.length); // Loop through every script collected and eval it for(var i=0; i

URL: http://rd.acer.edu.au/rd/index-with-load-more/

Any other solutions ?

bigsouth
# 12
bigsouth

Hey adam.kolinski!
I see from your link, that you indeed did solve this problem ... and that your load-more-thingie is working.
Mind shading some light on what way you went? :)