Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 19th, 2004, 02:34 AM
Registered User
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to webmeister
Default PHP quandery

I am having a problem...
for some reason my styles are not working in the switch at line 83 of my php code....
it displays the text but not the formating set in the styles... any advice?

All the other styles are working fine.

Any advice, especially from the authors would be greatly appreciated.

Thank You

Lines 83 to 110 (section where problem is)
Code:
  <?PHP

      switch($CERTstatus){
          case "0":
          // indicates Team is on Stand By
          echo "<tr>";
          echo "<td class=\'CERTstatus_S\'><b>CERT STATUS:</b> STAND BY</td>";
        echo "</tr>";
        break;

    case "1":
        // indicates Team is Deploying
        echo "<td class=\'CERTstatus_D\'><b>CERT STATUS:</b> DEPLOYED</td>";
        break;

        case "2":
        // indicates Team is on Training/Disaster Simulation
        echo "<td class=\'CERTstatus_T\'><b>CERT STATUS:</b> TRAINING</td>";
        break;

        default:
        // indicates Team is on ERROR / STATUS UNKNOWN
        echo "<td class=\'CERTstatus_U\'><b>CERT STATUS:</b> Unknown*<br> This may be due to a server malfunction or update</td>" ;
        break;

}
?>


Sorry for it being a long post with all the code but I do not know what is going on.



PHP CODE [/default_template.php]
Code:
<?PHP
    $pagetitle = "Welcome";
    $isUrgent = 0;
    $urgentInformation = "Major Flooding Causes Inwood Residents To Be With Out Power. <Br> Contact 311 for more information on resources available. If it is life threatening emergency call 911";
    $CERTstatus = "1";
    $mastHeadToDisplay = round((rand(1,24)/4),0);
    if($mastHeadToDisplay < 1) $mastHeadToDisplay = 1;
?>    

<html>
<head>
<title>NYC CB12M CERT TEAM - <?PHP echo($pagetitle);?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/Template.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0">






<table width="769" border="0" cellpadding="0" cellspacing="0">




     <tr> 
        <td><img src="images/masthead/mAST<?PHP print $mastHeadToDisplay; ?>.jpg" width="769" height="90" alt="NYC CB12M CERT LOGO with Cloisters"></td>
    </tr>



    <tr>
        <td class="WelcomeBar">Welcome to the Official Community Board 12 Manhattan 
            Public Safety Committee's Community Emergency Response Team Web Site</td>
    </tr>

    <tr> 
        <td>

        <table width="100%" border="0" cellspacing="0" class="LoginMenuBar">
                <tr class="LoginMenuBar">

                    <td class="LoginMenuBar">&nbsp;English | Espa&ntilde;ol</td>

                    <td class="LoginMenuBar"><div align="center" class="LoginMenuBar"><?PHP /*Add Date Time*/ print date("l, F d, Y"). " -- ". date("h:i:s A T"); ?></div></td>

                    <td class="LoginMenuBar"><div align="right" class="LoginMenuBar">Login | Register &nbsp;</div></td>
                </tr>
            </table>
        </td>
    </tr>

    <?PHP
        //Check to see if isUrgent has been activated

        if($isUrgent)
        {
        ?>
    <tr>

     <td>
     <div align="center" class="UrgentInformation"> <?PHP print $urgentInformation; ?> </div>
     </td>
    </tr>
    <?PHP
    }
    ?>
    <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>

                    <td width="180" valign="top">Navigation Section Here</td>

                    <td valign="top">Main Content Area / Pam's Greetings<br></td>

                    <td width="180">
                    <table class="RightColumn" width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr> 

                                <?PHP

                                        switch($CERTstatus){
                                            case "0":
                                                // indicates Team is on Stand By
                                                echo "<tr>";
                                                echo "<td class=\'CERTstatus_S\'><b>CERT STATUS:</b> STAND BY</td>";
                                                echo "</tr>";
                                              break;

                                            case "1":
                                                // indicates Team is Deploying
                                              echo "<td class=\'CERTstatus_D\'><b>CERT STATUS:</b> DEPLOYED</td>";
                                              break;

                                            case "2":
                                                // indicates Team is on Training/Disaster Simulation
                                              echo "<td class=\'CERTstatus_T\'><b>CERT STATUS:</b> TRAINING</td>";
                                              break;

                                          default:
                                                // indicates Team is on ERROR / STATUS UNKNOWN
                                             echo "<td class=\'CERTstatus_U\'><b>CERT STATUS:</b> Unknown*<br> This may be due to a server malfunction or update</td>" ;
                                              break;


                                      }
                                ?>                             
                            </tr>

                            <tr> 
                                <td>TERROR STATUS (NY)</td>
                            </tr>
                            <tr> 
                                <td>TERROR STATUS (FED)</td>
                            </tr>
                            <tr> 
                                <td>&nbsp;</td>
                            </tr>
                            <tr> 
                                <td>RANDOM INFO/NOTES</td>
                            </tr>
                            <tr> 
                                <td>RANDOM INFO/NOTES</td>
                            </tr>
                            <tr> 
                                <td>&nbsp;</td>
                            </tr>
                            <tr> 
                                <td>PARTICIPATING PARTNERS</td>
                            </tr>
                            <tr>
                                <td><p><em>NYPH<br>
                                        OEM</em></p>
                                    </td>
                            </tr>
                        </table></td>
                </tr>
            </table></td>
    </tr>
</table>

<br><br><br>
DESIGN &COPY; 2004 GH <BR>
CONTENT &COPY; 2003-2004 CB12MPUBSAFCERT
<BR>
<B> NOT FOR DISTRIBUTION
<BR> THIS IS A TEST
<BR> UNDER NO CIRCUMSTANCE IS THIS VERSION TO BE PUBLICLY ACCESSABLE
</body>
</html>



CSS CODE [/css/Template.css]
Code:
.LoginMenuBar {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: bold;
    font-variant: normal;
    color: #FFFFFF;
    text-decoration: none;
    background-color: #666666;
}

.WelcomeBar {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: bold;
    font-variant: normal;
    color: #FFFFFF;
    text-decoration: none;
    background-color: #006633;
}

.CERTstatus_S {
    font=size: 12px;
    font-weight: 900;
    color:#000000;
    background-color:#006633;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}    

.CERTstatus_D {
    font=size: 14px;
    font-weight: 800;
    color:#000000;
    background-color:#FF0000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}        

.CERTstatus_T {
    font=size: 12px;
    font-weight: 500;
    color:#000000;
    background-color:#FFB000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}        

.CERTstatus_U {
    font=size: 12px;
    font-weight: normal;
    color:#000000;
    background-color:#D8D8D8;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}            

.UrgentInformation{
    font=size: 14px;
    font-weight: 800;
    color:#FFFFFF;
    background-color:#FF0000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}        

P {
    font-size: 11px;
    color: #4c4c4c;;
    line-height: 15px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

TD{
    font-size: 11px;
    color: #4c4c4c;;
    line-height: 15px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}    

DIV{
    font-size: 11px;
    color: #4c4c4c;;
    line-height: 15px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}    

.UrgentInformation{
    font-size: 14px;
    font-weight: 800;
    color:white;
    background-color:red;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}    

.RightColumn {
    background-color: #E8E8E8;
    }
 
Old September 19th, 2004, 02:39 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default


You don't have to escape the single quotes:
 echo "<td class='CERTstatus_S'><b>CERT STATUS:</b> STAND BY</td>";

Since you're in a double quoted string, the single quote by itself is OK.

I'm also pretty sure that underscores in the classnames only works in IE.

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old September 19th, 2004, 02:42 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Your style sheet also has a few errors:
    font=size: 14px;

The equal should be a dash.

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old September 20th, 2004, 02:04 PM
Registered User
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to webmeister
Default

thank you
all

I wound up have to exit the <?PHP / ?> to get it to work,






Similar Threads
Thread Thread Starter Forum Replies Last Post
Beg. PHP 5 > Ch. 11 - fetch_field.php crater BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 January 2nd, 2007 12:20 PM
PHP Warning: PHP Startup: Unable to load dynamic l surendran Beginning PHP 1 May 29th, 2006 08:49 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM
Ch. 1: PHP Installation Troubles: php3 vs php manjito BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 June 12th, 2003 03:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.