WordPress.org

Forums

[resolved] Validating Integrated WP within design (29 posts)

  1. kannued
    Member
    Posted 9 years ago #

    I have successfully integrated WP within my design. The blog works. But when I go to validate it at w3, the validator has problems with the WP's doctype inside the design.

    DocTypes are usually at the beginning of the page. That validates fine. But then where I have included the WP, it has a problem with its DocType that appears in the middle of the file. Unfortunately, I can't give you a link because it is considered Google Juicing. So I don't know how this can be solved if a person can't see the problem.

    Gayle

  2. Ryan Fitzer
    Member
    Posted 9 years ago #

    Yes, you can provide a link.

  3. splanters
    Member
    Posted 9 years ago #

    Google juicing? I'm kinda new around here, but I think if you're posting the link for other's to see - so they can help, I don't see the problem with it... don't think anyone can answer your question unless you post the link.

    Congrats on trying to get it to validate - now let's see your stellar site, I bet it rocks

  4. kannued
    Member
    Posted 9 years ago #

  5. Ryan Fitzer
    Member
    Posted 9 years ago #

    Your defining the doctype twice. This is the problem. This is giving you duplicates of the head and body tags. You need to integrate WP in without all of the duplication.

  6. kannued
    Member
    Posted 9 years ago #

    So then I have to go into the header.php in the wp-content of my theme, and removed the DocType, head and body?

    What about style type and all the link rel within the head? Then I have to transfer that to my main design?

  7. Ryan Fitzer
    Member
    Posted 9 years ago #

    Quickly thinking about it, what you would need to do is take all of the contents of header.php and integrate them into the main head elament of your site, get rid of the call to the header.php in all of the templates. Then get rid of the duplicate body tags.

  8. kannued
    Member
    Posted 9 years ago #

    I tried pulling the code into the main design. But my paths are now all mixed up. The problem is because the paths are coded not in html, but dependent on php files. And I am still waiting for my Ullman's PHP book.

    <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" />
    <style type="text/css" media="screen">
    @import url( <?php bloginfo('stylesheet_url'); ?> );
    </style>

    <link rel="stylesheet" type="text/css" media="print" href="<?php echo get_settings('siteurl'); ?>/print.css" />
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />

    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php wp_get_archives('type=monthly&format=link'); ?>
    <?php //comments_popup_script(); // off by default ?>
    <?php wp_head(); ?>

  9. kannued
    Member
    Posted 9 years ago #

    These links are moving down to my root directory. I don't know how to begin to recode for a root directory in php.

  10. Ryan Fitzer
    Member
    Posted 9 years ago #

    Well, my only suggestion would be to use an <iframe> until the book comes. Although, I am halfway through this book and I don't think it will help on this problem. Your trying to push a square peg (WP) into a round hole (your existing site). It would be a lot easier to just alter a theme to have the look of your current site. Good luck.

  11. tsguitar
    Member
    Posted 9 years ago #

    You could just put this at the top of your main page:
    <?php require('pathtoyourwordpressinstall/wp-config.php'); ?>

    You can use WordPress functions on any page as long as the page knows where to find that config file. So you can build your own static page and pull content from your WP database to display on that page. This means that you don't have to worry about WP writing headers for you. You can just use WP functions to display content you want. This might help:
    http://wordpress.org/support/topic/83086?replies=2

  12. kannued
    Member
    Posted 9 years ago #

    Ryan,

    I couldn't find a three column theme that just had images in its left and right columns. All three columns were filled with code that I needed in the centre column, or in the footer.

    I tried the iframe which works but confines the grey background only to the center piece.

    tsguitar,
    my wp-config.php is in my root directory. when I call <?php require('wp-config.php'); ?> in the center column, nothing appears.

    http://www.kiplingcitizen.com/temp-require.html

    When I put it at the top of the page, nothing appears.

  13. moshu
    Member
    Posted 9 years ago #

    Because tsguitar gave you the wrong code :)
    To be able to use any WP function in another (non-WP) file, you need to add this:
    <?php require('./path-to-your-blog/wp-blog-header.php'); ?>
    at the top of that file, before anything else!

  14. tsguitar
    Member
    Posted 9 years ago #

    moshu: I've been able to get it working with wp-config... Huh... I must be completely mistaken. Well that means I need to go around to a few posts and fix my mistake! Glad we got it working, though.

  15. vkaryl
    Member
    Posted 9 years ago #

    Yup, HAS to be wp-blog-header.php - depending on host, the other can throw some TRULY AMAZING results! Been there done that.... wasn't pretty.

  16. kannued
    Member
    Posted 9 years ago #

    The wp-blog-header.php is in my root directory. http://www.kiplingcitizen.com/temp.html

    I have tried many variations. Either I get nothing, in the center column with my required code missing too.

    Or I get these two faults.
    Warning: require(./townofkipling.com/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /u/k/kcit0806/www.kiplingcitizen.com/temp.html on line 63

    Fatal error: require() [function.require]: Failed opening required './townofkipling.com/wp-blog-header.php' (include_path='.:') in /u/k/kcit0806/www.kiplingcitizen.com/temp.html on line 63

    I have tried the whole path using the absolute path (without the dot) and using the relative path. Then I get nothing in the center column nor in that section of view source.
    ?php require('/u/k/kcit0806/www.kiplingcitizen.com/wp-blog-header.php'); ?>

  17. kickass
    Member
    Posted 9 years ago #

    Did you try the URL?

    <?php require('http://www.kiplingcitizen.com/wp-blog-header.php');?>

  18. kannued
    Member
    Posted 9 years ago #

    The URL should not be used in the the path.

  19. moshu
    Member
    Posted 9 years ago #

    I don't think you can have it in a .html file. It has to be in a .php file!

  20. tsguitar
    Member
    Posted 9 years ago #

    Your page should have a php, phtml, or phtm extension if you want to execute PHP on it.

    @moshu: Sorry to muddle the issue, but other folks have reported being able to use wp-config.php with sucess. Here's one:
    http://wordpress.org/support/topic/82371?replies=20#post-423237

    It HAS to be wp-blog-header.php? Is this perhaps new to this latest release of WP? I've created a page that calls the RSS feed function from WP by including wp-config.php, not wp-blog-header.php. This is obvisouly not a support question, but I want the correct information.

  21. kannued
    Member
    Posted 9 years ago #

    I have my htaccess set to handle php script as html
    In this file below, which has the duplicate doctype
    http://www.kiplingcitizen.com/temp-backup.html

    tsquitar,
    I looked on that guy's view code at http://www.amateurillustrator.com/index.php, and I can't see his use of php require. I did a search for "require" without the quotes and nothing showed up.

  22. kannued
    Member
    Posted 9 years ago #

    Why would the code disappear in my own page?

    It is supposed to be located here

    <td width="16%"><img src="graphics/left-banner.gif" align="top" alt="advertise" /></td>
    <td width="68%"><?php require('/u/k/kcit0806/www.kiplingcitizen.com/wp-blog-header.php'); ?></td>
    <td width="16%"><img src="graphics/left-banner.gif" align="top" alt="advertise" /></td>

    I programmed it as such, save as such, and ftp it in ascii, then that php require line disappears!

  23. kannued
    Member
    Posted 9 years ago #

    This is a known bug when code disappears

    http://wordpress.org/support/topic/54927?replies=4#post-427524

  24. Ryan Fitzer
    Member
    Posted 9 years ago #

    You will not see <?php require('/u/k/kcit0806/www.kiplingcitizen.com/wp-blog-header.php'); ?> when you view the source of a page with a browser because this php script gets executed on the server. This goes for all server-side scripting languages. Basically, the server reads the contents of the file, does whatever it says and then outputs it to the browser. If you could see it than that means it has been handled incorrectly.

  25. kannued
    Member
    Posted 9 years ago #

    I see! I can't see the code in the viewsource because it is being handled correctly. But I did not get any output. There was a blank section where the blog should have been.

  26. kannued
    Member
    Posted 9 years ago #

    So now what do I do if the php is executing correctly?

    http://www.kiplingcitizen.com/temp.html

    Below shows the WP is working but with the duplicate doctype, etc.

    http://www.kiplingcitizen.com/temp-backup.html

    Here, I was ready to give up. And now there is still hope to integrate!

  27. Ryan Fitzer
    Member
    Posted 9 years ago #

    Most modern browsers will pick up the slack on a lot of invalid code. This isn't recommended as you will not be able to be reasonably sure that your site will work for your intended audience. I believe the amount of time you spent putting WP into your site could have easily yielded success with you putting your site into WP. Your site seems to be tentatively working but I am positive you will be running into a multitude of problems down the road when you want to add more functionality in the form of plugins, upgrades, etc...

  28. kannued
    Member
    Posted 9 years ago #

    I have never even thought of putting my site into WP. I guess I should read up on that.

  29. Ryan Fitzer
    Member
    Posted 9 years ago #

    What I mean by that so there is no confusion. Find a theme with the basic format you want and then alter the css to have your original site's look. Your current navigation would be a little tricky, but if your the one who originally created it than I think you'll be able to do it just fine. This way you'll be able to get the full amount of functionality and benifit out of WP instead of associating with a lot of future headaches.

Topic Closed

This topic has been closed to new replies.

About this Topic