Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Jul 2005
    Posts
    12
    Member #
    10480
    I am new to PHP and MySQL, and am using the Sam's Book "Teach Yourself PHP, My SQL, and Apache in 24 Hours". The Currently, I am working on the Chapter "Creating a Simple Discussion Forum". I have been able to make some changes to the basic scripts they provide in order to make them useful for my purposes (I designed and maintain a website for a charitable organization).

    In the example "Adding Posts to a Topic" (which I have attached), I would like to use the style sheet I use on the rest of the site, ans well as the Side Server Includes, but can't get it to work properly. Before I edit it, the script works perfectly, however, when I make the changes, all I get is a blank screen. I am trying to add like this:

    print "
    <html>
    <head>
    <title>Valley of the Mist Quilters Guild Board</title>
    <link rel="stylesheet" type="text/css" href="test.css">
    </head>
    <body>
    <DIV id="header">
    <!--#include virtual="/header.html" -->
    </DIV>

    ...and so on for the rest of the SSI's I use.

    Can anyone tell me where I am going wrong? I am hoping to add a simple message board to the site I maintain, and with a few changes, this would work perfectly.

    Thank You in advance

  2.  

  3. #2
    Senior Member Stylise's Avatar
    Join Date
    Jul 2005
    Location
    Mount Martha, Australia
    Posts
    229
    Member #
    10679
    To include in PHP, use the following:

    PHP Code:
    ?> // end PHP
    <html>
    <head>
    <title>Valley of the Mist Quilters Guild Board</title>
    <link rel="stylesheet" type="text/css" href="test.css">
    </head>
    <body>
    <DIV id="header">
        <? include("/header.html"); ?>
    </DIV>
    <? // start PHP

  4. #3
    Junior Member
    Join Date
    Jul 2005
    Posts
    12
    Member #
    10480
    Need some clarification, please

    aI tried forllowing your suggestiona s best I could, but being very new to php, I am probably doing something wrong because I still end up with a blank page when I make changes.

    I stated by inserting ?> just before <html> and <? just after </html>, which gave me a blank screen. I'm guessing, but is this because the html is the print function string? Also, if I do end the php before starting the html, how would the variables in the html be applied?

    I also end up with a blank screen when I add the line:
    <link rel="stylesheet" type="text/css" href="test.css">
    either by itself or like this (following a previous example from the book):
    include("link rel="stylesheet" type="text/css" href="test.css");
    or:
    <? include("link rel="stylesheet" type="text/css" href="test.css"); ?>

    Al of this was before I added the divs.

    Any help with both getting the CSS to work and to understand why is greatly appreciated.

  5. #4
    Senior Member Stylise's Avatar
    Join Date
    Jul 2005
    Location
    Mount Martha, Australia
    Posts
    229
    Member #
    10679
    When doing something like this it's probably easier to think of the php page as being a html page with php elements. So you just do your html page normally. And then add the php to it. ie.

    php file.
    PHP Code:
    <html>
    <head>
    <title>Valley of the Mist Quilters Guild Board</title>
    <link rel="stylesheet" type="text/css" href="test.css">
    </head>
    <body>
    <div id="header">
        <? include("header.html"); ?>
    </div> 

    And I'm a body.
    </body>
    </html>
    header.html.
    HTML Code:
    I am a Header.
    Or you can do it all in php with print,

    PHP Code:
    <?
    print "<html>
    <head>
    <title>Valley of the Mist Quilters Guild Board</title>
    <link rel=stylesheet type=text/css href=test.css>
    </head>
    <body>
    <div id=header>"
    ;
        include(
    "header.html");
    print 
    " </div> 

    And I'm a body.
    </body>
    </html>"
    ;
    ?>
    But to me, it seems a little messy.

    What you have to be aware of is that it you use print, you can't put any " charaters inside of it, unless you use:

    PHP Code:
    print "<div id=\"header\">"
    Also, I would put the <html> to <body> tags inside of the header file, like so:

    HTML Code:
    <html>
    <head>
    <title>Valley of the Mist Quilters Guild Board</title>
    <link rel=stylesheet type=text/css href=test.css>
    </head>
    <body>
    <div id="header">
        I am a Header.
    </div>


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:53 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com