Web Analytics Made Easy -
StatCounter Need help with array - CodingForum

Announcement

Collapse
No announcement yet.

Need help with array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with array

    I am trying to figure this out and want to eventually convert all my sites to PHP. My first task is to make a table that I can stick into the main page of one of my sites and then start moving everything in that direction (templatize) and since I am dense it makes for all the more fun
    I use the same basic table structures throughout the site and want to start there. I'm a little confused about the approach so maybe someone could offer a better way. Starting with a table array that I can call text include files into or from:
    <?PHP tables.php
    $main = array (

    *// this is obviously the beginning of nested tables
    shell=>"<p><TABLE cellspacing='0' cellpadding='0' width='100%' align='center' border='0'><tr><td><TABLE cellspacing='1' cellpadding='1' align='center' border='0' bgcolor='#036501' width='100%'><tr><td align='center' bgcolor='#ECFFEC'>",

    *//Can I put a reference to a text file in headtext?
    headtext=>"<span class='redflshbg'>Juniors, Seniors Baseball Try Out Information</span></td></tr>",

    *//Same question, can I put a reference to a text file in bodytext?
    bodytext=>"<tr><td bgcolor='#FFFFFF' class='grnbxlg'><div align='center'>Starts Saturday February 28th<br>Kent<p>TRY OUT TIMES:</span><ul><li></li></blockquote></div>",
    *//What about these line items should they be separate text include files?

    shellEND=></td></tr></TABLE></td></tr></TABLE>
    );
    ?>
    Then in the HTML file I would have:
    <body>
    <?
    include 'tables.php';
    echo $main[shell][headtext"headtextfile1.txt"][bodytext"bodytextfile1.txt"][shellEND];
    NOT SURE HOW TO DO THIS, IS WHAT I DID RIGHT?: calling the table and text files
    ?>
    OR
    <?
    include 'tables.php';
    ?>

    I can see that you could maybe call an array (text files) from within the table array but not sure how. Does this make sense or am I going about this wrong?
    Thanks in advance

  • #2
    Sorry for the bad impression

    Apologies for the bad first impression...
    I fingered part of it out! syntax error! so now that I have output I can start to tweek and then hopefully refine...

    Comment


    • #3
      making it simpler

      Trying to make things simple so below is the neew and my problem now is that I am getting code in my output. Could someone looksee what I'm doing wrong? headtext and shelEND are showing up. I next want to replace the text and that will be the next Q:
      <?PHP
      $table = array (
      shellA=>"<p><TABLE cellspacing=0 cellpadding=0 width=100% align=center border=0><tr><td><TABLE cellspacing=1 cellpadding=1 align=center border=0 bgcolor=#036501 width=100%>",
      shellB=>"<tr><td align=center bgcolor=#ECFFEC>",
      headtext=>"<span class=redflshbg>Juniors, Seniors Baseball Try Out Information</span></td></tr>",
      bodytext=>"<tr><td bgcolor=#FFFFFF class=grnbxlg>Starts Saturday February",
      shellEND=>"</td></tr></TABLE></td></tr></TABLE>"
      );
      echo $table;

      ?>

      Comment

      Working...
      X