SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: please explain

  1. #1
    SitePoint Addict Mower's Avatar
    Join Date
    Feb 2004
    Location
    Aussie Aussie Aussie
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question please explain

    Ok here is what I am trying to do

    Code:
    <?php
    $root = './';
     
    include ($root . 'includes/xhtml_head.inc');
    include ($root . 'includes/javascript.inc');
    include ($root . 'includes/stylelink.inc');
     
    echo "</head>";
    echo "<body>";
     
    include ($root . 'includes/page_top_hdr.inc');
     
    ?>
    The 3 top include files just call xhtml code

    xhtml_head.inc (example)

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>titles are cool</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    ok so would they need a closing php tag? like in the example below? also can you just call php code with out the php tags, if using the include?
    example

    Code:
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>titles are crap</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <?php

    So can someone explain it to me? i am lost. what is the correct way of doing this.

    Mower
    Last edited by Mower; Apr 13, 2004 at 05:20.


    "Will I ever find my way to GURU?"

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    You don't need a closing PHP tag. Include files, which "included" so-to-speak, are seperate and need to enter into PHP themselves.

  3. #3
    SitePoint Addict Mower's Avatar
    Join Date
    Feb 2004
    Location
    Aussie Aussie Aussie
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok so there is no effect the php script tags that called the include file? right

    also is there is better way to do a block quote in php? and also is the correct away of using xhtml in side a if statement, or how would a guru do this?

    example
    PHP Code:
    <?php
     
    if (condition condition) {
    ?> 
        <p> a string of words </p>
        <p>Please Login To View This Page</p> 
             <form method="post" action="login.php" name="loginform"> 
         <div class="logintext">Please enter your user name here</div> 
             <input type="text" tabindex="1" maxlength="10" size="10" name="id"> 
         <div class="logintext">Please enter your password here</div> 
             <input type="password" maxlength="10" size="10" name="pass" /> 
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
             <input type="submit" name="Submit" value="login" /> 
         </form> 
    <?php
    }
    Thanks in advanced Mower


    "Will I ever find my way to GURU?"

  4. #4
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Yep, that's how I do it and in another thread ages ago I ran some tests and that way works out slightly quicker.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •