Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Set table header row font weight

  1. #11
    Join Date
    May 2011
    Posts
    49
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by ApacheTech View Post
    The change you need to make is on the highlighted line, in red.

    Code:
    <table>
    <? foreach($file as $line) { $split = split(',', trim($line)); ?>
        <tr>
            <?php foreach($split as $num) { $neg = (!$th && $num < 0) ? true : false; ?>
            <?php echo ($th) ? '<th>' : '<td '.($neg) ? 'class="negative">' : '>'; ?>
                <?php echo $num; ?>
            <?php echo ($th) ? '</th>' : '</td>'; } ?>
        </tr>
        <?php $th = false; } ?>
    </table>
    Ok, the parsing error is gone, but I now get this:

    class="negative"> class="negative"> Jan class="negative"> Feb class="negative"> Mar class="negative"> Apr class="negative"> May class="negative"> Jun class="negative"> Jul class="negative"> Aug class="negative"> Sep class="negative"> Oct class="negative"> Nov class="negative"> Dec class="negative"> 2000 class="negative"> 446 class="negative"> 166 class="negative"> 268

    This is the data file I'm using if this helps.

    Code:
    ,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec
    2000,446,166,268,220,162,35,-24,212,300,146,-36,294
    2001,167,57,12,92,170,107,72,77,186,105,-28,129
    2002,166,156,-11,191,206,298,326,66,128,24,29,25
    2003,253,77,177,82,73,64,96,96,98,13,78,109
    2004,28,22,122,128,-7,-13,88,137,-7,74,29,-13
    2005,73,89,67,213,35,-14,74,-104,28,137,19,12
    2006,-57,40,-32,70,136,37,58,-65,-8,1,27,17
    2007,-34,90,-49,96,77,118,230,228,40,49,113,80
    2008,446,45,207,101,67,108,208,150,542,715,200,174
    2009,99,103,290,-33,188,62,159,-67,46,-5,24,32
    2010,27,117,47,21,117,99,154,-32,4,19,46,0
    2011,51,71,68,46,2,44,84,72,209,126,41,16
    2012,-16,52,74,-43,6,75

  2. #12
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default

    This works for me:

    HTML Code:
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset=utf-8" />
            <title>SIF Trading Systems - About</title>
            <link href="styles.css" rel="stylesheet" type="text/css" />
            <link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-base.css" />
            <link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-topbar.css" />
            <link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-sidebar.css" />
            <script type="text/javascript" src="ddlevelsfiles/ddlevelsmenu.js"></script>
            <script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
            <style type="text/css">
                table
                {
                    border-width:5px;
                    border-style: solid;
                    border-collapse:collapse;
                    border-color:#415065;
                    background-color:#B6CEFF;
                    cellpadding:2px;
                    cellspacing:2px;
                    width:600px;
                }
                
                td.negative
                {
                    color: #f00;
                }
            </style>    
        </head>
        
        <body class="twoColFixLtHdr">
            <div id="container">
                <div id="header" class="fltlft">
                    <img src="images/logo.jpg" alt="SIF Trading Systems Logo" class="fltlft" />
                    <img src="images/software_box.jpg" alt="Software Box" class="fltrt" />
                </div>
                
                <div class="clearfloat"></div>
    
                <div id="left_column">
                    <!--#include file="menu.shtml" -->
                </div>
    
    
                <div id="mainContent">
                    <h1>Monthly Net Points by Year</h1>
                    <div id="contentTable">
                        <table>
                            <? foreach(file('clientFTP/SixInOne_MonNet.txt') as $row=>$data) { $cell = explode(',', trim($data)); ?>
                            <tr>
                                <?php foreach($cell as $num) { $neg = ($num<0); ?>
                                <?php echo ($row < 1) ? '<th': '<td', ($neg) ? ' class="negative"' : '', '>'; ?>
                                    <?php echo $num; ?>
                                <?php echo ($th) ? '</th>' : '</td>'; } ?>
                            </tr>
                            <?php } ?>
                        </table>
                    </div>
                </div>
                
                <div class="clearfloat"></div>
                
                <div id="footer">
                    <p>
                        <a href="index.html">Home</a>
                    </p>
                </div>
                
                <p id="copyright">Copyright &copy; 2009 SIF Trading Systems</p>
                <img alt="" src="images/menu_tile.jpg" style="display: none" />
            </div>
    
        </body>
    </html>

  3. The Following User Says Thank You to ApacheTech For This Useful Post:

    Atom (07-05-2012)

  4. #13
    Join Date
    May 2011
    Posts
    49
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default

    Darned if doesn't work for me too. I must have copied something wrong earlier. I'm going to work on having all the table data be in bold text and getting the table border to complete around the partially complete last year. If I can't get it, I might be back, but thanks so much for your help.

    tom

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
  •