Viewing 9 replies - 1 through 9 (of 9 total)
  • Try renaming your file from index.html to index.php
    PHP can’t run in a html document without some type of special server and htaccess settings.

    Thread Starter Christiaan

    (@christiaan)

    Still get a blank page. And not only that if I try to view the page source of /index.php in my web browser it appears blank, when it’s not as far as my FTP app and Dreamweaver are concerned.

    The “creating a static front page” instructions are meant to make a WordPress Page become the homepage of the blog portion of your website. However, if your blog doesn’t reside in your toplevel directory it can’t “create” the index page of your site unless you do some .htaccess magic or somesuch.

    What you CAN do is call in parts of your blog into your static homepage. Instructions here:
    https://www.ads-software.com/support/topic/45242

    See it in action here, in the right side column:
    https://kickasswebdesign.com

    One caveat– if you’re already indexed in the search engines for yourdomain.com/index.html and you change the page to yourdomain.com/index.php you will LOSE your SE ranking. There is a way to change the .htaccess so that php will be recognized in pages that have .htm and .html extensions. If the site is new and not really recognized yet it won’t matter.

    Thread Starter Christiaan

    (@christiaan)

    Still get a blank page. kickass, the thread you point to doesn’t appear to give different advice to what I’ve already done. Yes I’m trying to call parts of my blog to my root index page. I’ve tried this code, as per the thread you pointed to:

    <?php
    require_once("blog/wp-blog-header.php");
    define('WP_USE_THEMES', false);
    ?>

    But it’s still showing a blank page??

    You need to set the php parser to be able to parse .html extensions. You do this by setting an Apache (or other server) handler to parse .html extensions with x-httpd-php

    For CPanelX:
    In the main admin area, go to “Apache Handlers”. Then to add it, under “Extensions” type:
    .html
    …then under “Handler” type:
    x-httpd-php
    …then click Add of course and viola. All your html extension files will now be parsed by the php processor if there’s any php code in them. I’m pretty sure this is what you’re looking for. Hope it helps.

    Thread Starter Christiaan

    (@christiaan)

    Thanks Nookster, do I still need to do this even if I’m using index.php as opposed to index.html

    Is there any CODE on the root level index page? I mean, there has to be something there. Try putting something simple there for testing. ie (<h1>hello world</h1>). If that little PHP block you had on your page was all that was there, of course nothing will show!

    Thread Starter Christiaan

    (@christiaan)

    Yes <h1>hello world</h1> works.

    This is indeed the only code I had on the page. I thought that was all I needed:

    <?php
    require_once("blog/wp-blog-header.php");
    define('WP_USE_THEMES', false);
    ?>

    I guess this issue is solved by now, but in case others find there way here I would like to point out that I believe that the reason why Christian had an empty page was because his require_once and define was in the wrong order. The default index.php for WP looks like this:

    <?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, true);
    require(‘./wp-blog-header.php’);
    ?>

    so in his case the following probably would have worked

    <?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, true);
    require(‘blo/wp-blog-header.php’);
    ?>

    a simple one would look like this:

    <?php
    define(‘WP_USE_THEMES’, false);
    require_once(‘blog/wp-blog-header.php’);

    get_header(); ?>

    <div id=”page”>
    <div id=”content”>
    Welcome to xyz.com
    </div>

    <?php get_sidebar(); ?>

    </div>

    <?php get_footer(); ?>

    ?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Calling php onto a static page’ is closed to new replies.