• Resolved Spinland

    (@spinland)


    Before you roll your eyes, I have searched extensively on this topic. I have found lots of information on how to turn off the template and include X number of posts using a query, and so forth. That’s not what I’m after.

    I currently embed my blog into an existing page using an iframe. I would like to stop doing that, both to transition my site into XHTML Strict and because iframes don’t get crawled by search bots. I’m using a much simplified template that works very well in its enclosed form.

    What I want is the same display I now have: the entire blog, sidebar, header, content, footer, template style, everything, just bracketed inside the fixed-size div element I have set aside for it currently as an iframe. I have yet to find any information on how to accomplish that specific task. Simply doing a PHP include on the index.php of the blog doesn’t appear to work.

    Many thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You are going to have trouble with that because you are going to have to load some basic html to get to your div:

    <html>
     <head></head>
     <body>
      <div id="yourwrapperdiv">
       <!-- hopefully include WP here -->
      </div>
     </body>
    </html>

    But including WP will result in a whole new <html> block, which is invalid as all get-out but strangely enough I’ve actually seen it work. The only thing I can think of that you might be able to do is edit your theme’s header.php and footer.php to remove the redundant markup– head, body, etc.– and depend on the wrapper page to provide that. You’ll probably have to include WP functions into your wrapper page too.

    Why can you not just add your size-limiting div to the theme?

    Thread Starter Spinland

    (@spinland)

    Because the existing site is generated by a WYSIWYG application and has a set style and design. The blog itself is using a very simple theme and is currently fed into a <div> block on the page using an iframe, but I want to transition the site from XHTML Transitional to Strict and that means ditching iframes. It would also be nice if the actual blog text were served as part of the page so search engines could find it.

    I’ve tried replacing the iframe with an <object> tag, which one would think is the proper way to do it, but that bombs on Internet Explorer and apparently there’s no way to make it work (I’ve tried numerous “fixes” I’ve found via Google and though they all work in Firefox none work at all in IE). I was hoping there were some way simply to call the WP code in a similar fashion as iframes but that was Strict compliant.

    Now I’m starting to believe it just cant be done. All hail Microsoft.

    Thread Starter Spinland

    (@spinland)

    Okay, just in case anyone is interested the issue has been resolved, though not via PHP include. The proper method for XHTML Strict compliance should be via the <object> tag, Microsoft’s failure properly to implement that notwithstanding. There is a workaround. Your blog must lie on the same server as the web site itself. In the case of the following example it’s installed into a folder off the web site’s root called my_blog_folder.

    <!--[if IE]>
        <object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" type="text/html"
            data="my_blog_folder/index.php" style="width:100%;height:100%;">
            <p>Fallback text</p>
        </object>
     <![endif]-->
     <!--[if !IE]><-->
        <object type="text/html" data="my_blog_folder/index.php" style="width:100%;height:100%;">
            <p>Fallback text</p>
        </object>
    <!--><![endif]-->

    Enclose this in a <div> tag styled to the size of the block you want the blog to appear in, and it will give you scroll bars if the blog’s larger than the <div> size.

    Now I can bring the blog in and satisfy the XHTML Strict standard, for whatever that’s worth.

    Thanks for looking.

    Functionality wise, how is that solution different from an iframe?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Embedding entire blog into existing page with PHP include?’ is closed to new replies.