SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    useless script... :p

    : Heres something I came up with the idea to make at work and when I got home I made. : Its a frameset that uses its self for each frame. Pretty much its a self contained frame site. I don't know if it has much real use, but I thought I'd post it anyway to see what you guys say.


    PHP Code:


    <?php

    if ($frame == top) { 
    echo 
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
    echo 
    "\n";
    echo 
    "<html>\n";
    echo 
    "<head>\n";
    echo 
    "    <title>Untitled</title>\n";
    echo 
    "</head>\n";
    echo 
    "\n";
    echo 
    "<body bgcolor=\"#0000ff\">\n";
    echo 
    "\n";
    echo 
    "\n";
    echo 
    "\n";
    echo 
    "</body>\n";
    echo 
    "</html>"

    elseif (
    $frame == left) { 
    echo 
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
    echo 
    "\n";
    echo 
    "<html>\n";
    echo 
    "<head>\n";
    echo 
    "    <title>Untitled</title>\n";
    echo 
    "</head>\n";
    echo 
    "\n";
    echo 
    "<body bgcolor=\"#00ff00\">\n";
    echo 
    "\n";
    echo 
    "\n";
    echo 
    "\n";
    echo 
    "</body>\n";
    echo 
    "</html>";

    elseif (
    $frame == body) { 
    echo 
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
    echo 
    "\n";
    echo 
    "<html>\n";
    echo 
    "<head>\n";
    echo 
    "    <title>Untitled</title>\n";
    echo 
    "</head>\n";
    echo 
    "\n";
    echo 
    "<body bgcolor=\"#FF0000\">\n";
    echo 
    "\n";
    echo 
    "\n";
    echo 
    "\n";
    echo 
    "</body>\n";
    echo 
    "</html>";

    else { 
    echo 
    "<html>\n";
    echo 
    "<head>\n";
    echo 
    "<title>Untitled Document</title>\n";
    echo 
    "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
    echo 
    "</head>\n";
    echo 
    "\n";
    echo 
    "<frameset rows=\"80,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\"> \n";
    echo 
    "  <frame name=\"topFrame\" scrolling=\"NO\" noresize src=\"frameset.php?frame=top\" >\n";
    echo 
    "  <frameset cols=\"80,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\"> \n";
    echo 
    "  <frame name=\"leftFrame\" scrolling=\"NO\" noresize src=\"frameset.php?frame=left\">\n";
    echo 
    "  <frame name=\"mainFrame\" src=\"frameset.php?frame=body\">\n";
    echo 
    "</frameset>\n";
    echo 
    "</frameset>\n";
    echo 
    "<noframes><body bgcolor=\"#FFFFFF\" text=\"#000000\">\n";
    echo 
    "\n";
    echo 
    "</body></noframes>\n";
    echo 
    "</html>";



    ?>
    I pretty much used the file name frameset.php but you can change it to what ever you want.

  2. #2
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey, you can try taking out the echos...and instead of a billion echos (personally, I use prints rather than echos...dunno why) you can just end and restart the php script...like this.

    <?php
    if ($frame == "top"){
    print ("this is the");
    print ("top frame");
    }elseif ($frame == "middle"){
    print ("this is the");
    print ("middle frame");
    }else{
    print ("this is the");
    print ("bottom frame");
    }
    ?>

    that was my brief thing of your script, which is all fine and dandy when you only have a few prints or echos, but if you have a whole lot more, then rather than using print or echo, I would just do this

    <?php
    if ($frame == "top"){
    ?>
    this is the<BR>
    top frame
    <?php
    }elseif ($frame == "middle"){
    ?>
    this is the<BR>
    middle frame
    <?php
    }else{
    ?>
    this is the<BR>
    bottom frame
    <?php
    }
    ?>


    and that will save you some time in the whole programming, and some space, because when you end and restart the code, anything inbetween the end and start commands, will be treated just like a regular webpage, and the if statements and loops and what not, carry over even through that.

    just my 2 cents
    signature

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I cheated to get all the echos there... I made the html code then I dropped it into a converter my friend gave me and it put my html code inside the echo statements... When i made this, I just wanted to see if it could be done.
    Last edited by therunes; Aug 23, 2001 at 23:03.

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even better why not just use this

    PHP Code:
    <?
    if ($frame == top) { 
    ?>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <html>
        <head>
            <title>Untitled</title>
        </head>
        <body bgcolor="#0000ff">
        </body>
        </html> 
    <?
        

    elseif (
    $frame == left) { 
    ?>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <html>
        <head>
            <title>Untitled</title>
        </head>
        <body bgcolor="#00ff00">
        </body>
        </html>
    <?
        

    elseif (
    $frame == body) { 
    ?>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <html>
        <head>
            <title>Untitled</title>
        </head>
        <body bgcolor="#FF0000">
        </body>
        </html>
    <?
        

    else { 
    ?>
        <html>
        <head>
        <title>Untitled Document</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        </head>
        <frameset rows="80,*" frameborder="NO" border="0" framespacing="0"> "
          <frame name="topFrame" scrolling="NO" noresize src="frameset.php?frame=top" >
          <frameset cols="80,*" frameborder="NO" border="0" framespacing="0"> "
          <frame name="leftFrame" scrolling="NO" noresize src="frameset.php?frame=left">
          <frame name="mainFrame" src="frameset.php?frame=body">
        </frameset>
        </frameset>
        <noframes><body bgcolor="#FFFFFF" text="#000000">
        </body></noframes>
        </html>
    <?
        

    ?>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •