Support » Fixing WordPress » how to adjust the old html-pages?

  • I want my old html-files to use the same template as the wp-files.
    So I’ve split the index.php into 3 (as described in the thread about integrating other files into wp): header.php. posts.php and footer.php
    the main index.php calls those 3 files and that works fine, see: http://www.boneless.nl/aa/
    Now for the old-files i did the following:
    <?php include(‘wp-includes/header.php’) ?>
    <div class=”storycontent”>
    then follows the original html (the body section)
    and then follows:
    </div>
    <?php include(‘wp-includes/footer.php’) ?>
    It just don’t work, neither does hard coding the entire url to header and footer.
    I’ve made an example, see: http://www.boneless.nl/aa/popquiz/uitleg.php
    ofcourse all the wpress-files are in the standard wp-dirs.
    So, what can I do to make the entire site looks like the layout of the wp-part of the site?
    Please help!
    Boneless

Viewing 15 replies - 1 through 15 (of 21 total)
  • Ok. what you need to do for your includes is include the full path to header.php and footer.php. Start your uri with “/path to wp-includes/wp-includes/header.php”
    Also, be sure your including:
    <?php require(‘wp-blog-header.php’); ?> (with correct paths)
    That is if your uitleg.php page has calls to bring up the categories, archives and other WordPress related functions. Without this, you can not make any calls to WordPress functions.
    Hope that helps.

    Thread Starter boneless

    (@boneless)

    I’m sorry, but i don’t really get it.
    So below is the code I use in uitleg.php, which is in a dir called popquiz. the wp-files are under http://www.boneless.nl/aa/
    what should I alter in the code below to get it to work and call the wp-functions?
    thanks! (a lot!)
    <?php include(‘./wp-includes/header.php’) ?>
    <div class=”storycontent”>
    Via boneless.nl zijn twee popquizzen te spelen: de algemene popquiz en de fragmentenquiz. Deze quizzen worden regelmatig vernieuwd, echter niet op een vast moment. Wie op de hoogte gehouden wil worden van nieuwe quizzen, kan zich aanmelden voor de mailinglist (binnenkort mogelijk).
    De algemene popquiz bestaat uit tien multiple-choice vragen. In principe kan naar vrijwel alles worden gevraagd: jaartallen, titels van songs, namen van artiesten, noteringen, algemene muziekkennis, etcetera. Vergeet niet uw naam en emailadres in te vullen, anders is het niet mogelijk u de juiste antwoorden te sturen. Na het invullen van alle vragen klikt u onderaan de pagina op verzenden. De juiste antwoorden ontvangt u binnen 72 uur via email.
    De fragmentenquiz bestaat uit tien muziekfragmenten. Aan u de taak deze fragmenten te herkennen en de juiste titel en artiest(en) in te vullen. Vergeet ook hier niet uw naam en emailadres in te vullen. Na het invullen van alle antwoorden klikt u onderaan de pagina op verzenden. De juiste antwoorden ontvangt u binnen 72 uur per email.
    Vragen over de twee quizzen kunt u stellen via: popquiz@boneless.nl.<br>
    Ditzelfde adres kunt u gebruiken voor opmerkingen over de twee quizzen.
    </div>
    <?php include(‘wp-includes/footer.php’) ?>

    <?php include('./wp-includes/header.php') ?>
    I would have that as the very first thing on the page, and if you are getting errors, it’s because the browser is looking for the file in the wrong place.
    http://www.boneless.nl/aa/ <——blog
    http://www.boneless.nl/popquiz <——-your file
    If that is correct, the path will be something like
    <?php include('./aa/wp-includes/header.php') ?>
    or
    <?php include('../aa/wp-includes/header.php') ?>
    You need to tell it to go out of the directory it is in, find the right directory, then dig in there.

    Well, from this file
    http://www.boneless.nl/aa/popquiz/uitleg.php
    the (relative) path to the wp-includes directory probably would look like
    <?php include('../aa/wp-includes/footer.php') ?>
    Try a search for relative path in Google if you don not understand them 🙂

    I should learn to type faster 🙂 Podz always beats me (LOL)

    On a similar point, is there a commented index.php file somewhere?
    I want to modularize my code, but I’m not totally sure where to start/stop cutting.
    It would be header, content, footer. But, for example, “do not remove this line”. Does it go in the header? The content? Does it matter?
    Another example, I have a subscription form that uses javascript to verify the fields are filled out. The form itself sits where <menu> used to be, but the jscript is in the header. I assume I can put all this in the “footer” include and it will render accordingly, but again I’m not sure.

    I just rewrite the old html files to new php files
    ie: rewriterule ^index\.html /journal/index.php

    The header file should be everything from the line:
    <div id="content">
    up to the top of the file

    @anon – head or header? I mean where the script sits?
    I my understanding head, body et. co… they are html tags or elements of a html file.
    Header, footer and other similar stuff – they are part of the display, design if you wish.

    moshu: the anon poster wishes to split his index.php file into 3 seperate files so that he may use the header and footer on other pages to retain the style through the site.
    My site is an example of this

    Thread Starter boneless

    (@boneless)

    I know I have to tell it to find the relative path, but even when I do that, I get errors:
    when I use this line:
    <?php include(‘../wp-includes/header.php’) ?>
    is goed back 1 dir, the enters the wp-includes dir and adresses the header.php
    this is ok, but then the following errors occur:
    Warning: main(): Unable to access ./wp-blog-header.php in /home/virtual/site27/fst/var/www/html/aa/wp-includes/header.php on line 3
    Warning: main(./wp-blog-header.php): failed to open stream: No such file or directory in /home/virtual/site27/fst/var/www/html/aa/wp-includes/header.php on line 3
    Fatal error: main(): Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/php/includes:/usr/share/php’) in /home/virtual/site27/fst/var/www/html/aa/wp-includes/header.php on line 3
    all errors caused by the header.php file in the wp-includes dir.
    and this is that header.php file:
    <?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;
    <head profile=”http://gmpg.org/xfn/1″&gt;
    <title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title>
    <meta http-equiv=”Content-Type” content=”text/html; charset=<?php bloginfo(‘charset’); ?>” />
    <meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” /> <!– leave this for stats –>
    <style type=”text/css” media=”screen”>
    @import url( <?php echo get_settings(‘siteurl’); ?>/wp-layout.css );
    </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(); ?>
    <meta name=”robots” content=”all” />
    </head>
    <body>
    <div id=”rap”>
    <h1 id=”header”>“><?php bloginfo(‘name’); ?></h1>
    <p id=”description”>Beschouwingen, meningen, anekdotes en andere nietszeggende teksten van de altijd vriendelijke en goedgemutste boneless.
    So, how to solve this errors?
    Thanks again!

    Sorry, forgot to login.
    Let me put it another way:
    I’m old (less of a trainwreck) site I had a navbar/header that I kept in a seperate php file. Then I would just <?php include blah blah blah?> on each page. So if I wanted to edit the header (add a link or something) it changed site-wide with one edit.
    Now, enter wordpress. The main page is just “news” updates whatever. Then I have a few other sections that don’t really fit the “blog” format, but I would like to have the same design for all pages (like the guy above) regardless of their content.
    So far, I get what I have to do which is modularize some things. And where I get stuck is . . .
    index.php right now calls only the updates category since it is the “updates” page using:
    ‘<?php
    $blog = 1;
    if (!isset($cat)) {
    $cat = “1”;
    }

    So, if I start modularizing things and make a “header.php” a “content.php” and a “footer.php”, where would the above go. . .in “content.php”?
    And what about things like stylesheet links and such? Does it even matter as long it’s somewhere?

    The easiest way to do it is keeping all files in the wordpress folder. This will avoid the need for messing with paths for includes.
    If your wordpress is installed in: site.com/wordpress
    The header and footer should go in site.com/wordpress/wp-includes and all of the ‘pages’ like index.php or contact.php or links.php etc should go in site.com/wordpress
    IF you want to place files outside of those directories you must do 1 of 3 things: Mess with the include paths until you can get them to work.
    Copy you header file to the directory you are calling it from ie: site.com/
    OR rewrite URLs so that they point to the wordpress directory
    For example on my site
    adailyadventure.com/photos/ points to adailyadventure.com/journal/photos/
    This avoids the need to change the include paths or maintain more than one header file.

    Thread Starter boneless

    (@boneless)

    Damn, I wish life was simple 🙂
    So I am now rewriting all mainfiles to put them in the main wp-dir.
    I think it’s slowly getting to work now, see:
    http://www.boneless.nl/aa/
    and try the first 3 links (the quiz) and the commercials.
    Now all I need is a new questbook I can put on the server with the same template, anyone have a good idea?
    Thanks all for helping out, slowly getting there.
    Boneless

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘how to adjust the old html-pages?’ is closed to new replies.