• hello,
    1. Default index.php in wordpress looks like this:
    <?
    define(‘WP_USE_THEMES’, true);
    require(‘./wp-blog-header.php’);
    ?>

    2. I have a file called index_make.php which looks like this:

    <?
    ob_start();

    define(‘WP_USE_THEMES’, true);
    require(‘./wp-blog-header.php’);

    $plik=fopen(‘index.html’, ‘w’);
    fwrite($plik, ob_get_contents());
    fclose($plik);

    ob_end_flush();
    ?>

    3. index.html is a generated, cached file by index_make.php.

    PROBLEM IS:

    Why index.html has no posts?
    Everything is well generateg without posts.. why?

    Who have any idea how to solve this problem?

Viewing 6 replies - 1 through 6 (of 6 total)
  • WordPress uses index.php to pull the posts out of the database and display them using your theme’s files.

    The server won’t recognise a static HTML page as PHP, so the code won’t run, and no content will be displayed.

    If you need to cache for performance reasons, try a plugin such as WP Super Cache.

    If you need to do this for some other reason, please post again and say what you’re trying to achieve – someone may have an idea of another way to do it.

    Thread Starter maxbmx

    (@maxbmx)

    I really need it cos on my index.php is:
    * last topics from my forum
    * best photo from gallery
    * statistics

    I would like to make index php once an hour.

    (i have about 40000 page views per day, and i would like to decrease server load.) I use wp-cache

    Thread Starter maxbmx

    (@maxbmx)

    anybody?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Instead of rolling your own solution to this, use WP-Super-Cache instead. It caches pages as static HTML files and then uses some clever mod_rewrite rules to send users the static files when appropriate. Eliminates tons of CPU load.

    Thread Starter maxbmx

    (@maxbmx)

    I use wp-super-cache… but i have for exemple last topics from phpbb3, last photo from gallery etc on my index.php so i would like to generate index.html once an hour

    Thread Starter maxbmx

    (@maxbmx)

    nobody knows how to solve this problem? 🙁

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘index.html generated from index.php in wordpress’ is closed to new replies.