baseportal
Start

baseportal message board

Welcome to the baseportal message board...

Please read the FAQ.

 
 Selected message: To the list 
    Message from McQ on 11/14 2003, 11:29 -06:00
    EMail: mcqnet@att.net

    Re: Alternate colors for every record


      The documentation you read shows you how to make a table manually with HTML tags, then use a conditional perl statement with a counter to decide which background color to use. After that's decided, you use baseportals "out" command mixed with HTML table tags to constuct the table one element at a time.

      For your page, tinker with some code like this:
      # this section creates the table and writes the heading row:

      <table cellpadding=2 border=1 cellspacing=0>
      <tr><td>State</b></td><td>Lake/Riv/Res</td><td>Month</td> ... </tr>

      # next you'll write each data record, one field at a time. the "loop" construct will perform all of the instructions between <loop> and </loop> for every record in the db. thus:

      <loop code=perl>
      if($_loop % 2==0)
      { out '<tr bgcolor="#a0a0a0">';
      } else
      { out '<tr bgcolor="#e0e0e0">';
      }
      out "<td>$State</td><td>$Lake/Riv/Res</td><td>$Month</td> ... </tr>";
      </loop>
      </table>

      The "if" statement figures out what row you're on, so which background row color to use. The <td>$Month</td> stuff is just the HTML table data tags around the database field name (case sensitive). The $ before the field name makes it a variable, and baseportal will place the value of that field in that record in that spot. If your fieldname has special characters (like / or $), refer back to the documentation to see how to handle them. Perhaps the $_loop(fieldname) method would be helpful. If all else fails, rename the fields, leaving out the offending characters.

      I'm a novice here too, but the above will help, with some tweaking. A warning: it won't be quick, but if you're inclined to learn a lot, or if you'll want to customize the display of your data, it's a helpful exercise to undertake. There's lots of places on the net to find out more about constructing HTML tables, and color charts to pick the HEX codes (the #e0e0e0 stuff) for your background colors.

      I hope this helps, and good luck.

    Your reply:

    Name: EMail: WWW:
    Subject:
    Text:
    Timezone:

    Post a new message


 All messages from this thread: To the list 
    Message from Ed on 11/14 2003, 00:37 +00:00
    EMail: schmidte@putnam.k12.il.us WWW: www.BassFishingLog.com

    Alternate colors for every record


      I read the section "Switch background color with every record" in the "baseportal Documentation" section, but I'm not sure where to insert the code. The code I have on my wesite now: http://www.BassFishingLog.com, is:

      <p><do action=all databack=f0f0f0 datasize=1 headback=99ccff border=0 spacing=2 padding=2 gridcolor=336699 dataface=arial,helvetica sort^=- range^=0,15 pagebrowse=top,bottom buttonbrowse=top,bottom listtype=list listfields=State,Lake/River/Res.,Month,Water\ Temp,H2O\ Clarity\ (inches),Lure(s),Structure,Depth,Weather,Air\ Temp.,Comments input=bottom>

      Where do I put the "alternate color" code?
      Could someone advise me on how to do it.
      Thanks,
      ED

     Post a reply

    Message from McQ on 11/14 2003, 11:29 -06:00
    EMail: mcqnet@att.net

    Re: Alternate colors for every record


      The documentation you read shows you how to make a table manually with HTML tags, then use a conditional perl statement with a counter to decide which background color to use. After that's decided, you use baseportals "out" command mixed with HTML table tags to constuct the table one element at a time.

      For your page, tinker with some code like this:
      # this section creates the table and writes the heading row:

      <table cellpadding=2 border=1 cellspacing=0>
      <tr><td>State</b></td><td>Lake/Riv/Res</td><td>Month</td> ... </tr>

      # next you'll write each data record, one field at a time. the "loop" construct will perform all of the instructions between <loop> and </loop> for every record in the db. thus:

      <loop code=perl>
      if($_loop % 2==0)
      { out '<tr bgcolor="#a0a0a0">';
      } else
      { out '<tr bgcolor="#e0e0e0">';
      }
      out "<td>$State</td><td>$Lake/Riv/Res</td><td>$Month</td> ... </tr>";
      </loop>
      </table>

      The "if" statement figures out what row you're on, so which background row color to use. The <td>$Month</td> stuff is just the HTML table data tags around the database field name (case sensitive). The $ before the field name makes it a variable, and baseportal will place the value of that field in that record in that spot. If your fieldname has special characters (like / or $), refer back to the documentation to see how to handle them. Perhaps the $_loop(fieldname) method would be helpful. If all else fails, rename the fields, leaving out the offending characters.

      I'm a novice here too, but the above will help, with some tweaking. A warning: it won't be quick, but if you're inclined to learn a lot, or if you'll want to customize the display of your data, it's a helpful exercise to undertake. There's lots of places on the net to find out more about constructing HTML tables, and color charts to pick the HEX codes (the #e0e0e0 stuff) for your background colors.

      I hope this helps, and good luck.

     Post a reply
     

 Messages from 3150 to 3300: To the input form 
<< Newest messages | < Newer messages | To the input form | Older messages > | Oldest messages >>


Back to the homepage

© baseportal.com. All rights reserved. Terms of use



powered in 0.04s by baseportal.com
Get your own Web Database - for FREE!