SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member BillyBean2009's Avatar
    Join Date
    Jul 2001
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    **Need Help Once Again**

    ok I got
    PHP Code:
    <?php

     
    switch($c){
      case 
    'reviews':
       echo(
    "Reviews"); // review stuff
      
    break;

      case 
    'downloads':
       echo(
    "Downloads"); // downloads stuff
      
    break;

      case 
    'video':
       echo(
    "Video"); // video stuff
      
    break;
     
      case 
    'pictures':
       echo(
    "pictures"); // pictures stuff
      
    break;

      default:
     Echo(
    "Main"); // Main stuff
       
    break;
     }
    ?>

    Insted of like
    echo("pictures")

    How would I tell it to do HTML and not to put new text out???
    Beyond Good.
    Beyond Evil.
    Beyond Your Darkest Imagination.

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you explain it a little more clearly? I'm not understanding what exactly you're asking.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not entirely sure I know what you mean by "DO HTML" but instead of:

    echo("pictures")

    put echo("<tr><td><img src='something.gif'></td></tr>");


    or whatever you want the html to be.

    Is that what you meant?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  4. #4
    SitePoint Member BillyBean2009's Avatar
    Join Date
    Jul 2001
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I mean is.
    Insted of just the script putting "Reviews"
    I want it to put
    Code:
    <TD vAlign=top width="100%"> 
          <TABLE cellSpacing=0 cellPadding=0 width="85%" align=center 
          bgColor=#314263 border=0>
            <TBODY> 
            <TR> 
              <TD> 
                <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                  <TBODY> 
                  <TR> 
                    <TD bgcolor=#314263><B>Reviews
    </TD>
                  </TR>
                  <TR> 
                    <TD bgColor=#212121>&nbsp; </TD>
                  </TR>
                  </TBODY> 
                </TABLE>
              </TD>
            </TR>
            </TBODY> 
          </TABLE>
        </TD>
    So that it would make a Table on the page and not just text.
    But each time I replace "Reviews" or "Video" basically any of em with that HTML, It loads a white page and does nothing.
    Last edited by BillyBean2009; Oct 25, 2001 at 15:44.
    Beyond Good.
    Beyond Evil.
    Beyond Your Darkest Imagination.

  5. #5
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use something like this instead (notice the forward slashes in \" and \n
    PHP Code:
    <?php
    echo("<TD vAlign=\"top\" width=\"100%\">\n" .
    "<TABLE cellSpacing=\"0\" cellPadding=\"0\" width=\"85%\" align=\"center\" bgColor=\"#314263\" border=\"0\">\n" .
    "<TBODY>\n<TR>\n<TD><TABLE cellSpacing=\"1\" cellPadding=\"3\" width=\"100%\" border=\"0\">\n" .
    "<TBODY>\n<TR>\n<TD bgcolor=\"#314263\"><B>Reviews</TD>\n</TR>\n<TR>\n" .
    "<TD bgColor=\"#212121\"></TD>\n</TR>\n</TBODY>\b</TABLE>\n" .
    "</TD></TR></TBODY></TABLE></TD>");
    ?>
    All right. Now, the \" simply escape the quotes so that the echo() function does not end prematurely. The \n simply makes the PHP print that HTML code to a new line (so it is easier to read when you view the source HTML code when viewing in a browser).

    The " . at the end of those lines simply allow me to type the PHP code in multiple lines (so I do not have to scroll some horrible horizontal distance) and still have echo() function continue on the following line. If you like horizontal scrolling, they are not needed however.

    If you have any more questions, let us know!
    Last edited by Aes; Oct 25, 2001 at 15:57.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  6. #6
    SitePoint Member BillyBean2009's Avatar
    Join Date
    Jul 2001
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh My!
    Thank you so much!!!
    It works perfect! woah
    Thanks so much you 2! oh and I'll be back for more Q's I know it!
    Thanks again!
    damn I love this place...
    Beyond Good.
    Beyond Evil.
    Beyond Your Darkest Imagination.

  7. #7
    SitePoint Member
    Join Date
    Jul 2001
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's a much better idea to include() a file rather than echo all the html, escaping every little " or '. Makes it a lot easier to change too.

  8. #8
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ew! Ew! too many echos!
    PHP Code:
    <?php
    switch($c)
    {
     case 
    'reviews':
    ?>
    <TD vAlign=top width="100%"> 
          <TABLE cellSpacing=0 cellPadding=0 width="85%" align=center 
          bgColor=#314263 border=0>
            <TBODY> 
            <TR> 
              <TD> 
                <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                  <TBODY> 
                  <TR> 
                    <TD bgcolor=#314263><B>Reviews</TD>
                  </TR>
                  <TR> 
                    <TD bgColor=#212121>  </TD>
                  </TR>
                  </TBODY> 
                </TABLE>
              </TD>
            </TR>
            </TBODY> 
          </TABLE>
        </TD>
    <?php
    break;
    }
    or you could do what jdf said and do the include file
    PHP Code:
    <?php
    switch($c)
    {
     case 
    'reviews':
      include(
    'html.php');
      
    //html.php would hold the code you have above.
     
    break;
    }
    ?>
    Last edited by Defender1; Oct 25, 2001 at 20:58.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  9. #9
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how about this??

    Why not easier..

    Code:
    function what($that){
    ?>
    <TD vAlign=top width="100%"> 
          <TABLE cellSpacing=0 cellPadding=0 width="85%" align=center 
          bgColor=#314263 border=0>
            <TBODY> 
            <TR> 
              <TD> 
                <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                  <TBODY> 
                  <TR> 
                    <TD bgcolor=#314263><B><? echo "$that";  ?>
    
    </TD>
                  </TR>
                  <TR> 
                    <TD bgColor=#212121>  </TD>
                  </TR>
                  </TBODY> 
                </TABLE>
              </TD>
            </TR>
            </TBODY> 
          </TABLE>
        </TD>
    <?
    }
    
    if ($c == "reviews){
    what("Reviews");
    }
    else
    etc..
    or what would be easiest.. is just do it like this..

    change the select to get there from reviews --> Reviews and just do it like this:
    Code:
    ?>
    <TD vAlign=top width="100%"> 
          <TABLE cellSpacing=0 cellPadding=0 width="85%" align=center 
          bgColor=#314263 border=0>
            <TBODY> 
            <TR> 
              <TD> 
                <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                  <TBODY> 
                  <TR> 
                    <TD bgcolor=#314263><B><? echo "$c" ?>
    </TD>
                  </TR>
                  <TR> 
                    <TD bgColor=#212121>  </TD>
                  </TR>
                  </TBODY> 
                </TABLE>
              </TD>
            </TR>
            </TBODY> 
          </TABLE>
        </TD>
    <?
    Now no if statement is needed and no extra vars are needed no functions ....

    Well good luck

    Peanuts
    the neigbours (free) WIFI makes it just a little more fun

  10. #10
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, you would need the if before there to determine the value of $c
    also would need it if different code gets put in for each condition.

    one more thing, if he doesn't understand if's well, why are you throwing functions at him?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


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
  •