WordPress.org

Forums

Ajaxed auto reload div troubleshooting (2 posts)

  1. egeyisi
    Member
    Posted 6 years ago #

    One of the most weird problems of all times...

    With the aid of prototype.js, i added an ajaxed div auto-reloader on my page. It means that, instead of auto refreshing the whole page, thanks to this script, i can make auto-refreshed each minute one of the divs. Now I want to do it for the published posts listing. In other words, I want to the the titles (with their links of course) of the recent posts in a div which will be auto reloded each minute.

    Now... The problem is that the script that i use obliges me to use a php include structure to do it. And when I try to applicate, it gives me this: "Fatal error: Call to undefined function: have_posts() in /nfs/c02/h07/mnt/39816/domains/verkac.com/html/feed/wp-content/themes/default/news.php on line 1" ...

    Let me paste the script here:

    <script src="http://www.verkac.com/feed/wp-content/themes/default/prototype.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
    
    var count = 0;
    
    function test() {
    var myAjax = new Ajax.PeriodicalUpdater(
    'content', // div to update
    'http://www.verkac.com/feed/wp-content/themes/default/news.php',
    {
    method: 'get', // HTTP
    evalScripts: true, //
    frequency: 2, //
    decay: 0 //
    }
    );
    }
    
    test(); //run without click
    
    </script>

    And in the body part, I have this:

    <div id="content">
    <?php include('news.php'); ?>
    </div>

    I think that I must create a new root file which I should call news.php but I don't know how to do it. I tried to hack wp-blog-header.php, template-loader.php etc. It doesn't work.

    Are there anyone who know to create a second root file besides index.php?

    Thanx a lot...

    Erhun

  2. f1f
    Member
    Posted 6 years ago #

    Did you manage to solve this?

Topic Closed

This topic has been closed to new replies.

About this Topic