Forums

index.html generated from index.php in wordpress (7 posts)

  1. maxbmx
    Member
    Posted 1 year ago #

    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?

  2. LesBessant
    Moderator
    Posted 1 year ago #

    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.

  3. maxbmx
    Member
    Posted 1 year ago #

    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

  4. maxbmx
    Member
    Posted 1 year ago #

    anybody?

  5. Otto42
    Moderator
    Posted 1 year ago #

    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.

  6. maxbmx
    Member
    Posted 1 year ago #

    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

  7. maxbmx
    Member
    Posted 1 year ago #

    nobody knows how to solve this problem? :(

Topic Closed

This topic has been closed to new replies.

About this Topic