• Hey everybody. I have what’s probably a really easy question for all you pros. I’m trying to make my homepage (ktriton.com) with this page: http://www.ktriton.com/news/index.php

    If you do go to http://www.ktriton.com, you’ll see that the index php file is messed up. The images are no biggie to fix, but I don’t understand what I’m supposed to do to get that wordpress page to display in the middle.

    Anybody have any ideas? I’ve been fooling around with this and reading up on tutorials for the past few days without success.

    Thanks to anyone who even bothers to check it out.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi ktriton,

    are you using the latest stable version or nightly?

    Thread Starter ktriton

    (@ktriton)

    Hey dissurion,

    Thanks for the quick reply. For WordPress? I’m using WordPress build 1.2.2. It’s the latest version. I think it’s called “Mingus”

    Why, is “Nightly” better for my purpose?

    That was just to know what to answer. 🙂 The beta version (1.5) uses themes with header, footer etc. I don’t think you should use beta version, that’s your choice. We’ll get this working no problem.

    Did you include the wp-header with <?php /* Don"t remove this line. */ require("./wp-blog-header.php"); ?>
    with the appropiate path to wp-blog-header?

    I mean on your index page, not on your /news/ page

    Thread Starter ktriton

    (@ktriton)

    Thanks a million! I really appreciate your help (I bet this is so simple for you :P)!

    Alright, well here’s the script that I made for the body of my index page:

    <?php
    include ‘header.php’;
    include ‘news/index.php’;
    include ‘footer.php’;
    ?>

    So, nope I didn’t include that line. Should I put it right above the “include ‘header.php’;” line?

    Yes, just put it on top of your page, eg having it look like this:

    <?php
    require("news/wp-blog-header.php");
    include 'header.php';
    include 'news/index.php';
    include 'footer.php';
    ?>

    Ofcourse the path to wp-blog-header should be set to reflect your setup.

    Thread Starter ktriton

    (@ktriton)

    Yup, that’s the path. Okay, so I did that and the top looks like it should, but the blog is still MIA and the bottom portion of the page is …missing altogether.

    So it’s…a partial victory 🙂

    Any ideas?

    Ah, wait. I see now you try to incorporate your index.php from the wp directory.
    One option, leaving your wp index file untouched, is to copy everything you want to appear, in another file, eg myindex.php, and place that in your wp directory or root directory, and include that file instead.
    I don’t know how your header looks like, but as a first step you could try this with everything in the ‘content’ div.

    Thread Starter ktriton

    (@ktriton)

    I see what you’re saying. So copy the template from the wp site and save it as ‘whatever.php’ and then do

    <?php
    require(“news/wp-blog-header.php”);
    include ‘header.php’;
    include ‘whatever.php’;
    include ‘footer.php’;
    ?>

    ?

    Not the whole template, only the part within the body you need (since you won’t need the header/footer part anymore).
    Eg, if you only need to have the title of every post appear, you could copy only the part of the template that causes the title to appear. Since you probably like to have all, a good start would be to try everything within the body, eg withing the div id=”content”.

    Thread Starter ktriton

    (@ktriton)

    Sweet! It worked! Thank you so much!

    http://www.ktriton.com

    Okay, now would you have any idea how to constrain the news.php so that there’s no overflow?

    It works but if you look at the source of your output it shows that you have 2 times a html head. You seem to have incorporated all of the wp index file. That causes the wp stylesheet to be incorporated too.
    So this is the first thing you’ll have to look into.

    Thread Starter ktriton

    (@ktriton)

    Yup–got that taken care of. Now to start making spacer images 🙂

    Thank you so very much for your, dissurion. Now that it’s showing up, my major anxiety is gone.

    Hi,

    I’m trying to do much the same as the original poster was trying to do. I am working on converting my website layout from using iframes to one using divs and css.

    I want to have my wordpress blog show up on the main page of the site, contained within a div. I need to use a php include to do this with. The index for my site has a side bar that uses php includes (PHP Currently, latest fanlistings joined code–as examples of why the main page has to have a .php extension).

    When I started out on this project, I thought it would be easy to get wordpress incorporated, but hours of frustration later, I’m ready to pull my hair out.

    As a reference to what I’m trying to do, the iframes version of the site is at http://www.written-in-stars.net/layout1.shtml. A crude version of the div/css based layout is at http://www.written-in-stars.net/test.php. It’s this second version that’s giving me fits.

    In my original attempt, I used this piece of code on the “test.php” site.

    <div id=”content”>
    <?php include(“./wp/index.php”); ?>
    </div>

    When I loaded the page into my browser, rather than my wp blog showing up, I ended up getting back this:

    Warning: main(./wp-blog-header.php): failed to open stream: No such file or directory in /home/drbrun0/public_html/wp/myindex.php on line 3

    Fatal error: main(): Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/drbrun0/public_html/wp/myindex.php on line 3

    On the layout1.shtml version of the site, the index shows up fine. Also, if you just put in http://www.written-in-stars.net/wp/index.php, the index shows up perfectly fine.

    So, I sat out looking for a solution and stumbled across this post, and started trying the things recommended above.

    First, I tried this piece of code (again, on the test.php page):
    <div id=”content”>
    <?php
    require(“wp/wp-blog-header.php”);
    include ‘wp/index.php’;
    ?>
    </div>

    I ended up getting back:
    Warning: main(./wp-blog-header.php): failed to open stream: No such file or directory in /home/drbrun0/public_html/wp/index.php on line 3

    Fatal error: main(): Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/drbrun0/public_html/wp/index.php on line 3

    Again, the layout1.shtml version and the index.php page on its own both work perfectly.

    So, my next stab at this was to follow the suggestion of making the “myindex.php” file. To make this file, I took the original index file, copied it into a new file, and chopped out this part from the top:

    <?php
    /* Don’t remove this line. */
    require(‘./wp-blog-header.php’);
    ?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
    <html xmlns=”http://www.w3.org/1999/xhtml”&gt;

    Nothing else was changed.

    On the test.php page, I changed the code to:

    <?php
    require(“wp/wp-blog-header.php”);
    include ‘wp/myindex.php’;
    ?>

    Then, I uploaded the whole mess. On the test.php page, I got back this message:

    Sorry, no posts matched your criteria.

    Powered by WordPress

    Loading http://www.written-in-stars.net/wp/myindex.php directly into my browser results in a blank page. I haven’t tried loading the myindex.php into the layout based on iframes and seeing if it works. I suspect it wouldn’t though.

    In additon to the above, I also tried the steps included on the “Have WordPress files and blog in different directories” page. That didn’t work either.

    This is probably such a simple thing to do, but it’s driving me crazy. I’m actually getting to the point of seriously considering using different blogging software. I perfer the admin/posting areas of wordpress, but if the blog isn’t going to show up….

    Much thanks in advance.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Compiling WordPress in a php file’ is closed to new replies.