Re: code quest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



well, this ends the row after every cell. I am trying to get a row of 5 cells across, then end it and start a new row. If the routines stops before the end of the count of 5 due to lack of further directories, closing out the table following the loops will onclude a </tr> tag.


On 2/14/2011 8:30 PM, Richard Quadling wrote:
On 15 February 2011 00:53, Kirk Bailey<kbailey@xxxxxxxxxxxxxxxx>  wrote:
Now I have a situation. I need to take the code from my former home page and
modify it to lay out a table (let's say 5 cells wide) and as many rows deep
to contain all the items. Each item is the name of the directory, under
which is an icon image from that directory, under which is a description
file read from that directory. Here is my code thus far:

<?php
# The next several lines declare an array of directories which are NOT to be
listed!#
$excludes[] = 'attachments'; #20
$excludes[] = 'data';
$excludes[] = 'include';
$excludes[] = 'resources';
$excludes[] = 'stats';
$excludes[] = '_private';
$excludes[] = '_vti_bin';
$excludes[] = '_vti_cnf';
$excludes[] = '_vti_log';
$excludes[] = '_vti_pvt';
$excludes[] = '_vti_txt'; #30
$excludes[] = '_vxi_txt';
$excludes[] = 'css';
$excludes[] = 'img';
$excludes[] = 'images';
$excludes[] = 'js';
$excludes[] = 'cgi';
$excludes[] = 'cgi-bin';
$excludes[] = 'ssfm';
$ls = scandir(dirname(__FILE__));
echo '<table border="1" cellspacing="5" cellpadding="0" bgcolor="E0E0E0"><tr
align="center">'; #40
foreach ($ls as $d) {  if (is_dir($d)&&  !preg_match('/^\./',basename($d))
&&!in_array(basename($d),$excludes))
  {
  echo '<td>'.$d.'<br><a href="'.$d.'"><img
src="/Categories/'.$d.'/thumb.png" border="5"></a><br>';
  include($d."/desc.txt");
  echo '</td>';
  };
};
echo '</tr></table>';
?>

Now I am stymied on changing this to add</tr><tr>  at the right points in
the structure. I am new to php, and welcome all suggestions and gainful
comments.
$ls = scandir(dirname(__FILE__));
echo '<table border="1" cellspacing="5" cellpadding="0" bgcolor="E0E0E0">'; #40
foreach ($ls as $d) {  if (is_dir($d)&&
!preg_match('/^\./',basename($d))&&!in_array(basename($d),$excludes))
  {
  echo '<tr align="center"><td>', $d,'<br><a href="', $d, '"><img
src="/Categories/', $d, '/thumb.png" border="5"></a><br>';
  include($d."/desc.txt");
  echo '</td></tr>';
  };
};
echo '</table>';

maybe?


--
end

Very Truly yours,
                 - Kirk Bailey,
                   Largo Florida

                       kniht
                      +-----+
                      | BOX |
                      +-----+
                       think


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux