• Hi All,

    I’m new to working with PHP (still a student) and have been attempting to embed WordPress into an HTML apDiv in Dreamweaver. The reasoning is because I want to keep the unified appearance and navigation functionality. The apDiv is set for scroll overflow as well.

    The php script I dropped into the HTML page is:
    <div id=”apDiv16″>
    <?php
    include(“wordpress/index.php”);
    ?>
    </div>

    The error I keep getting while trying to view the HTML page is:
    Fatal error: main() [function.require]: Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/lib/php’) in /homepages/14/d240057214/htdocs/wordpress/index.php on line 17

    When I revise the script to the following:
    <div id=”apDiv16″>
    <?php
    include(“/wordpress/index.php”);
    ?>
    </div>

    I get nothing (not even errors) in the apDiv… I’d rather see the errors. At least I know I’m closer to the mark.

    My question is whether it’s even possible to embed an “include” into an apDiv, and if so, what is the correct script I need to drop into my HTML document’s apDiv?

    I have also created and uploaded a .htaccess file according to my provider’s (1and1.com) instructions for parsing php within an HTML document.

    Thanks for any help offered. My head is swimming on this one and the life buoy has a leak!

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s a directory structure issue. When you include /wordpress/index.php, the code runs as if it resided in the directory in which the including file is located. Consequently, none of the subsequent includes work.

    What you need to do is to put WordPress into an iframe.

    The alternative is to so something like this:

    <div id="apDiv16">
    <?php
    
    readfile('http://localhost/wordpress/');
    
    ?>
    </div>

    but it is a little slower and may produce bad links.

    Thread Starter gapingredgroovie

    (@gapingredgroovie)

    Fantastic, NC! Worked like a charm and loads quite well actually. You were right about the incorrect directory structure and the code you so kindly posted was exactly what I needed. Of course, all I had to do on my end was to drop in the correct URL and it was all right there. Too cool for words, but my many thanks regardless.

    Regards!

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

The topic ‘Embed PHP’ is closed to new replies.