<?php
include 'simple_html_dom.php';
// Create DOM from URL
$html = file_get_html('http://some site. com/'); ?>
<?php
foreach($html->find('a.cellMainLink') as $title)
echo '<div class="title"><table class="title" cellspacing="0" cellpadding="0"><tr>
<td style="font-size:12px;">'.$title->plaintext.'</td></tr></table></div>';
?>
<?php
foreach($html->find('td.nobr') as $size)
echo '<div class="size"><table class="size" cellspacing="0" cellpadding="0"><tr>
<td>'.$size.'</td></tr></table></div>';
?>
<?php
foreach($html->find('td.green') as $seeds)
echo '<div class="seeds"><table class="seeds" cellspacing="0" cellpadding="0"><tr> <td>'.$seeds.'</td></tr></table></div>'; ?>
<?php
foreach($html->find('td.red') as $leechs)
echo '<div class="leechs"><table class="leechs" cellspacing="0" cellpadding="0"><tr> <td>'.$leechs.'</td></tr></table></div>'; ?>
<?php
foreach($html->find('strong a[1]') as $category)
echo '<div class="cat"><table class="cat" cellspacing="0" cellpadding="0"><tr><td>'.$category->plaintext.'</td></tr></table></div>'; ?>
<?php
foreach($html->find('a[class=idownload icon16]') as $down)
echo '<div style="font-size:12px">'.$down->href.'</div><br />'; ?>
right now the result in multiple echos.. i want all these results in one echo and then i will store the result into my database..
Use .=, in a php variable. It is the concatenating assignment operator.
<?php
include 'simple_html_dom.php'; // Create DOM from URL
$html = file_get_html('http://some site. com/');
$what_you_echo = "";
?>
<?php
foreach($html->find('a.cellMainLink') as $title)
$what_you_echo .= '<div class="title"><table class="title" cellspacing="0" cellpadding="0"><tr>
<td style="font-size:12px;">'.$title->plaintext.'</td></tr></table></div>';
?>
<?php
foreach($html->find('td.nobr') as $size)
$what_you_echo .= '<div class="size"><table class="size" cellspacing="0" cellpadding="0"><tr>
<td>'.$size.'</td></tr></table></div>';
?>
<?php
foreach($html->find('td.green') as $seeds)
$what_you_echo .= '<div class="seeds"><table class="seeds" cellspacing="0" cellpadding="0"><tr> <td>'.$seeds.'</td></tr></table></div>'; ?>
<?php
foreach($html->find('td.red') as $leechs)
$what_you_echo .= '<div class="leechs"><table class="leechs" cellspacing="0" cellpadding="0"><tr> <td>'.$leechs.'</td></tr></table></div>'; ?>
<?php
foreach($html->find('strong a[1]') as $category)
$what_you_echo .= '<div class="cat"><table class="cat" cellspacing="0" cellpadding="0"><tr><td>'.$category->plaintext.'</td></tr></table></div>'; ?>
<?php
foreach($html->find('a[class=idownload icon16]') as $down)
$what_you_echo .= '<div style="font-size:12px">'.$down->href.'</div><br />'; ?>
<?php echo $what_you_echo; ?>
You can style your code, by removing these lots of <?php:
<?php
include 'simple_html_dom.php'; // Create DOM from URL
$html = file_get_html('http://some site. com/');
$what_you_echo = "";
foreach($html->find('a.cellMainLink') as $title)
$what_you_echo .= '<div class="title"><table class="title" cellspacing="0" cellpadding="0"><tr><td style="font-size:12px;">'.$title->plaintext.'</td></tr></table></div>';
foreach($html->find('td.nobr') as $size)
$what_you_echo .= '<div class="size"><table class="size" cellspacing="0" cellpadding="0"><tr><td>'.$size.'</td></tr></table></div>';
foreach($html->find('td.green') as $seeds)
$what_you_echo .= '<div class="seeds"><table class="seeds" cellspacing="0" cellpadding="0"><tr> <td>'.$seeds.'</td></tr></table></div>';
foreach($html->find('td.red') as $leechs)
$what_you_echo .= '<div class="leechs"><table class="leechs" cellspacing="0" cellpadding="0"><tr> <td>'.$leechs.'</td></tr></table></div>';
foreach($html->find('strong a[1]') as $category)
$what_you_echo .= '<div class="cat"><table class="cat" cellspacing="0" cellpadding="0"><tr><td>'.$category->plaintext.'</td></tr></table></div>';
foreach($html->find('a[class=idownload icon16]') as $down)
$what_you_echo .= '<div style="font-size:12px">'.$down->href.'</div><br />';
echo $what_you_echo; ?>
Use a variable, and append the values.
<?php
$out = '';
include 'simple_html_dom.php';
// Create DOM from URL
$html = file_get_html('http://some site. com/');
foreach ($html->find('a.cellMainLink') as $title) {
$out .= '<div class="title"><table class="title" cellspacing="0" cellpadding="0"><tr>
<td style="font-size:12px;">'.$title->plaintext.'</td></tr></table></div>';
}
foreach ($html->find('td.nobr') as $size) {
$out .= '<div class="size"><table class="size" cellspacing="0" cellpadding="0"><tr>
<td>'.$size.'</td></tr></table></div>';
}
foreach ($html->find('td.green') as $seeds) {
$out .= '<div class="seeds"><table class="seeds" cellspacing="0" cellpadding="0"><tr>
<td>'.$seeds.'</td></tr></table></div>';
}
foreach ($html->find('td.red') as $leechs) {
$out .= '<div class="leechs"><table class="leechs" cellspacing="0" cellpadding="0"><tr>
<td>'.$leechs.'</td></tr></table></div>';
}
foreach ($html->find('strong a[1]') as $category) {
$out .= '<div class="cat"><table class="cat" cellspacing="0" cellpadding="0"><tr>
<td>'.$category->plaintext.'</td></tr></table></div>';
}
foreach ($html->find('a[class=idownload icon16]') as $down) {
$out .= '<div style="font-size:12px">'.$down->href.'</div><br />';
}
echo $out;
?>
I'm not sure but maybe this?:
<?php
include 'simple_html_dom.php'; // Create DOM from URL
$html = file_get_html('http://some site. com/');
$el_arr['a.cellMainLink'] = $html->find('a.cellMainLink');
$el_arr['td.nobr'] = $html->find('td.nobr');
$el_arr['td.green'] = $html->find('td.green');
$el_arr['td.red'] = $html->find('td.red');
$el_arr['strong [1]'] = $html->find('strong [1]');
$el_arr['a[class=idownload icon16]'] = $html->find('a[class=idownload icon16]');
foreach($el_arr as $key=>$el)
{
foreach($el as $node)
{
//echo your content accordingly here using $key and $node
//$key represent the type of element and $node represent a node of that type from html
}
}
creat a php array and put the results of each echo in this array and after echo the array
exemple:
<?php
$results=array[];
$our_var='';
foreach($html->find('a.cellMainLink') as $title)
{
$our_var='<div class="title"><table class="title" cellspacing="0" cellpadding="0"><tr>
<td style="font-size:12px;">'.$title->plaintext.'</td></tr></table></div>';
array_push($results,$our_var);
}
?>
do this to the others and after play with your array as you wish
include 'simple_html_dom.php'; // Create DOM from URL
$html = file_get_html('http://some site. com/');
$what_you_echo = "";
foreach($html->find('a.cellMainLink') as $title)
echo '<div class="title"><table class="title" cellspacing="0" cellpadding="0"><tr><td style="font-size:12px;">'.$title->plaintext.'</td></tr></table></div>';
$size = current($html->find('td.nobr'));
echo '<div class="size"><table class="size" cellspacing="0" cellpadding="0"><tr>
<td>'.$size.'</td></tr></table></div>';
next($html->find('td.nobr'));
how about this
Related
Here is a small snippet of the PHP-Code I use to create a HTML e-mail:
$tmpl = '<table border="0" width="100%";><tr><td>%title%</td></tr><tr><td>%text%</td></tr></table>';
$html = '<table border="0" width="100%";>';
$html .= '<td width="20%" style="padding:0;">';
if(isset($var)) {
$html .= 'Value: '.$object->val;
}
$html .= '</td>';
$html .= '</table>';
$tmpl = str_replace('%text%', $html, $tmpl);
$mail->setBody( $tmpl );
$mail->send();
Sometimes the mail in the HTML view when viewed inside an email program is broken because there is a space character inside an opening TD-Element. Like this:
< td width="20%" style="padding:0;">
Where is this space character coming from?
Had the same issue with php mail() function, my html styling was broken by seemingly random spaces. Using wordwrap() on the message before sending it with mail sorted out the problem.
$message = wordwrap($message, 70);
mail("person#example.com","Some subject",$message);
www.w3schools.com explanation, example
See this line here?
$html = '<table border="0" width="100%";>';
after width="100%" you do not need this symbol -> ;
Try removing it.
Markup has errors
$tmpl = '<table border="0" width="100%";><tr><td>%title%</td></tr><tr><td>%text%</td></tr></table>';
Notice the ; in border="0" width="100%";>
You're not concatenating $html
The following line overwrite the table built up earlier
$html = '</table>';
You need to change that to;
$html .= '</table>';
Suggested actions
I would suggest echoing the body of the mail, and validating it with w3.
Have a read...
Concatenating
Validate your markup
<?php
$tmpl = '
<table border="0" width="100%">
<tr>
<td>%title%</td>
</tr><tr>
<td>%text%</td>
</tr>
</table>';
$html = '<table border="0" width="100%">';
$html .= '<td width="20%" style="padding:0;">';
if(isset($var)) {
$html .= 'Value: '.$object->val;
}
$html .= '</td>';
$html .= '</table>';
//Debug:
// echo $html;
$tmpl = str_replace('%text%', $html, $tmpl);
$mail->setBody( $tmpl );
$mail->send();
I currently have this:
$output .= '
<tr>
<th style="text-align: left">'.(__("Item", "WSPSC")).'</th><th>'.(__("Quantity", "WSPSC")).'</th><th>'.(__("Price", "WSPSC")).'</th><th></th>
</tr>';
But I need to replace Item with a piece of php like:
$output .= '
<tr>
<th style="text-align: left">'.(__("
<?php if(ICL_LANGUAGE_CODE=='en'); ?>
Item
<?php elseif(ICL_LANGUAGE_CODE=='it'); ?>
Products
<?php endif; ?>
", "WSPSC")).'</th><th>'.(__("Quantity", "WSPSC")).'</th><th>'.(__("Price", "WSPSC")).'</th><th></th>
</tr>';
The issue I am having is that this is obviously wrong but I can't get my head around the correct concatenation of html and php
If I right understand you need something like this:
$output .= '
<tr>
<th style="text-align: left">'.
(
(ICL_LANGUAGE_CODE=='en')?
'Item':
( (ICL_LANGUAGE_CODE=='it')? 'Products': '' ),
"WSPSC"
)
.'</th><th>'.(__("Quantity", "WSPSC")).'</th><th>'.(__("Price", "WSPSC")).'</th><th></th>
</tr>';
You should not use it in that way. Look at this pseudo code:
$output .= '
<tr>
<th style="text-align: left">';
if (something...) {
$output.= 'sss';
}
elseif (something...) {
$output.= 'ddd';
}
That's the way you should do it.
Your replies helped me thanks, this worked:
$output .= '
<tr>
<th style="text-align: left">';
if (ICL_LANGUAGE_CODE=='en') {
$output .= (__("Item", "WSPSC"));
} elseif (ICL_LANGUAGE_CODE=='it') {
$output .= (__("PRODOTTO", "WSPSC"));
}
$output .= '</th><th>'.(__("Quantity", "WSPSC")).'</th><th>'.(__("Price", "WSPSC")).'</th><th></th>
</tr>';
I have a variable holding the structure of a table, I want to add php code inside the table. I've tried adding the code statement to a variable and then fetching the variable data inside the table but I Think is not possible, what is the right way of doing it.
$table='<table border="1" cellspacing="0" cellpadding="0"><tr>
<td width="638" valign="top">**ADD CODE HERE**</td></tr>
</table>';
echo $table;
Here is the code i want to add inside the column:
if($_SESSION['Mmsg']['Mreg-err'])
{
echo '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
}
if($_SESSION['Mmsg']['Mreg-success'])
{
echo '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-success']);
}
I've tried adding the code inside $notification and then adding
$notification='if($_SESSION['Mmsg']['Mreg-err'])
{
echo '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
}
if($_SESSION['Mmsg']['Mreg-success'])
{
echo '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-success']);
}';
' . $notification . '
Inside the table like:
$table='<table border="1" cellspacing="0" cellpadding="0"><tr>
<td width="638" valign="top">' . $notification . '</td></tr>
</table>';
echo $table;
But is not possible, is there a way to achieve this? i am a newbie
EDIT added your unsets...
if($_SESSION['Mmsg']['Mreg-err'])
$notification = '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
if($_SESSION['Mmsg']['Mreg-success'])
$notification = '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
unset($_SESSION['Mmsg']['Mreg-success']);
$table='<table border="1" cellspacing="0" cellpadding="0"><tr>
<td width="638" valign="top">' . $notification . '</td></tr>
</table>';
echo $table;
<?php
// snipped code
$table='<table border="1" cellspacing="0" cellpadding="0"><tr>
<td width="638" valign="top">' . $notification . '</td></tr>
</table>'
echo $table;
// snipped code
?>
This can be rewritten like this:
<?php
// snipped code
?>
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="638" valign="top"><?=$notification?></td>
</tr>
</table>
<?php
// snipped code
?>
Much cleaner, no?
The if statements also have alternative syntax which I find much easier to follow.
<?php
// snipped code
if($_SESSION['Mmsg']['Mreg-err'])
{
echo '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
}
if($_SESSION['Mmsg']['Mreg-success'])
{
echo '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-success']);
}
// snipped code
?>
This can be rewritten:
<?php
// snipped code
?>
<?php if($_SESSION['Mmsg']['Mreg-err']): ?>
<div class="err"><?=$_SESSION['Mmsg']['Mreg-err']?></div>
<?php unset($_SESSION['Mmsg']['Mreg-err']); ?>
<?php endif; ?>
<?php if($_SESSION['Mmsg']['Mreg-success']): ?>
<div class="success"><?=$_SESSION['Mmsg']['Mreg-success']?></div>
<?php unset($_SESSION['Mmsg']['Mreg-success']); ?>
<?php endif; ?>
<?php
// snipped code
?>
Now, if any errors occur, it will be much easier to debug and follow.
Could you just chuck the content you want into the $notification variable?
var $notification=""; // is 'var' idiomatic PHP? Not used it much lately.
if($_SESSION['Mmsg']['Mreg-err'])
{
$notification= '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
}
if($_SESSION['Mmsg']['Mreg-success'])
{
$notification = $notification . '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-success']);
}
$table='<table border="1" cellspacing="0" cellpadding="0"><tr> <td width="638" valign="top">' . $notification . '</td></tr> </table>';
echo $table;
However, there are a couple of things that seem odd to me about this.
Firstly, why have a separate Session variable for an error or success message? Why not have $_SESSION['Mmsg']['Mreg-outcome'] ? Then you don't need to switch like that.
Also do you need to echo the table at all? Why not just have your $notification variable available to the page and then have the table doing its thing like this in the page:
<table><tr><td>$notification</td></tr></table>
Finally, you had better not be using that table for anything other than the display of tabular data or you will make kittens cry. It looks suspiciously as though you might be planning to use it for page formatting.
What you are doing is perfectly correct just that you are not assigning values properly to the notification variable. This should work now.
if($_SESSION['Mmsg']['Mreg-err'])
{
$notification= '<div class="err">'.$_SESSION['Mmsg']['Mreg-err'].'</div>';
unset($_SESSION['Mmsg']['Mreg-err']);
}
if($_SESSION['Mmsg']['Mreg-success'])
{
$notification = $notification . '<div class="success">'.$_SESSION['Mmsg']['Mreg-success'].'</div>';
unset($_SESSION['Mmsg']['Mreg-success']);
}
$table='<table border="1" cellspacing="0" cellpadding="0"><tr><td width="638" valign="top">' . $notification . '</td></tr></table>';
echo $table;
Your question is not clear. I'm trying to guess whats your problem, try this:
$table='<table border="1" cellspacing="0" cellpadding="0"><tr>
<td width="638" valign="top">' . htmlentities($notification) . '</td></tr>
</table>';
echo $table;
see if this works
I have a table that displays my search results, and pending if a user has a function open I want to only display 5 results per row, and the same if they have it closed I want to show 7 results. This is working fine, but the issue I am having is when I toggle the function the div is hidden or shows but the PHP content that was dynamically created is still visible. I know that the div hides or shows pending the function because I wrote static text in the dynamically create divs and pending the function the text is shown or hidden.
Question: How to hide the php content as well?
PHP content =
/*BIG*/
//begin new row
if($result_incBig == $beginRowBig){
$b .= '<tr>';
//row color
$row_color = ($color_incBig % 2) ? 'tdAltRow_A' : 'tdAltRow_B';
if($i == ($num_qk-1)){
$secondRowClass = 'tdAltRow_noBorder';
}else{
$secondRowClass = 'tdAltRow';
}
//increment the color of the row
++$color_incBig;
}
$b .= '<td class="td_formTitle_noBorder" align="center" style="padding:0px; text-indent: 0;" width="165" height="115" valign="bottom">';
$b .= '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
$b .= '<tr>';
$b .= '<td align="center" style="height:80px; padding:4px; vertical-align:middle;">'.$appendLinkBegin.$companyPic.$appendLinkEnd.'</td>';
$b .= '</tr>';
$b .= '<tr>';
$b .= '<td align="center" style="height:35px; padding:2px; vertical-align:bottom;">'.$appendLinkBegin.'<b>'.$company_name.'</b>'.$addSpace.'<br />'.$num2.' '.$resultText.$appendLinkEnd.'</td>';
$b .= '</tr>';
$b .= '</table>';
$b .= '</td>';
//end row if out of results or reached max num for row
if($result_incBig == $endRowBig){
$b .= '</tr>';
$result_incBig = 0;
}else if(($i+1) == $num_qk){
if($result_incBig < $endRowBig){
for($e=0;$e<=($endRowBig-$result_incBig);++$e){
$b .= '<td class="td_formTitle_noBorder" align="center" style="padding:0px; text-indent: 0;" width="165" height="115" valign="bottom"><!--space--></td>';
}
$b .= '</tr>';
$result_incBig = 0;
}
}
//increment inc
++$result_incBig;
/*END BIG*/
/*SMALL*/
//begin new row
if($result_incSmall == $beginRowSmall){
$s .= '<tr>';
//row color
$row_color = ($color_incSmall % 2) ? 'tdAltRow_A' : 'tdAltRow_B';
if($i == ($num_qk-1)){
$secondRowClass = 'tdAltRow_noBorder';
}else{
$secondRowClass = 'tdAltRow';
}
//increment the color of the row
++$color_incSmall;
}
$s .= '<td class="td_formTitle_noBorder" align="center" style="padding:0px; text-indent: 0;" width="165" height="115" valign="bottom">';
$s .= '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
$s .= '<tr>';
$s .= '<td align="center" style="height:80px; padding:4px; vertical-align:middle;">'.$appendLinkBegin.$companyPic.$appendLinkEnd.'</td>';
$s .= '</tr>';
$s .= '<tr>';
$s .= '<td align="center" style="height:35px; padding:2px; vertical-align:bottom;">'.$appendLinkBegin.'<b>'.$company_name.'</b>'.$addSpace.'<br />'.$num2.' '.$resultText.$appendLinkEnd.'</td>';
$s .= '</tr>';
$s .= '</table>';
$s .= '</td>';
//end row if out of results or reached max num for row
if($result_incSmall == $endRowSmall){
$s .= '</tr>';
$result_incSmall = 0;
}else if(($i+1) == $num_qk){
if($result_incSmall < $endRowSmall){
for($e=0;$e<=($endRowSmall-$result_incSmall);++$e){
$s .= '<td class="td_formTitle_noBorder" align="center" style="padding:0px; text-indent: 0;" width="165" height="115" valign="bottom"><!--space--></td>';
}
$s .= '</tr>';
$result_incSmall = 0;
}
}
//increment inc
++$result_incSmall;
/*END SMALL*/
}
//display table
if($where == ''){
$b = '<input type="hidden" name="numberRes" id="numberRes" value="No Results" />';
$s = '<input type="hidden" name="numberRes" id="numberRes" value="No Results" />';
}
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
//results
echo '<div class="rowFillBig">big7Results'.$b.'</div>';
echo '<div class="rowFillSmall" style="display:none;">small5Results'.$s.'</div>';
echo '</table>';
The Jquery function:
$(function () {
$('#tab_1').click(function(){
$('#tab_vid').toggle();
if ($("#mainContentRF").width() == 825){
$("#mainContentRF").width(1180);
$("audio").width(800);
//if viewing the full screen pause video
<?php if($viewingVideo > ''){ ?>
video = $('.videoplayer').get(0);
video.pause();
<?php } ?>
<!--hide small-->
$(".rowFillSmall").css("display", "none");
<!--show big-->
$(".rowFillBig").css("display", "inline");
}else{
$("#mainContentRF").width(825);
$("audio").width(500);
<!--show small-->
$(".rowFillSmall").css("display", "inline");
<!--hide big-->
$(".rowFillBig").css("display", "none");
}
<!--if tab was left open dont close it-->
<?php if($acc_openValue_1 == '99'){ ?>
})
<?php }else{ ?>
}).click();
<?php } ?>
});
If I can be more clear please let me know. Basically the div and any content inside should hide when asked to, and show when asked.
Place the div's on the outside of the table like this.
echo '<div class="rowFillBig">';
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
//results
echo $b;
echo '</table>';
echo '</div>';
echo '<div class="rowFillSmall" style="display:none;">';
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
//results
echo $s;
echo '</table>';
echo '</div>';
I want to show nine images in a table , three images in each row using PHP.
It mostly depends on how you have PHP representing the images. The HTML markup should look something like
<div class="img-table">
<img ...>
<img ...>
<img ...>
....
</div>
and the CSS:
.img-table {
width:1000px; /* or whatever works */
}
.img-table img {
width:30%;
height:auto;
display:inline;
margin: 10px 1.5%; /* spacing: 20px vertically, 5% horizontally */
}
or, if you want to use <table> tables:
<table class="img-table">
<tr>
<td><img ...></td>
<td><img ...></td>
<td><img ...></td>
</tr>
.....
</table>
If you have your image urls located in a array, like
$imgs = array('path/to/img1.jpg','path/to/img2.jpg',...);
then you can generate the HTML like this:
$index = 0;
$html = '<div class="img-table">';
for ($i=0; $i<3; $i++) {
for ($j=0; $j<3; $j++) {
$html .= '<img src="' . $imgs[$index++] . '">';
}
}
$html .= '</div>';
echo $html;
or for the table:
$index = 0;
$html = '<table class="img-table">';
for ($i=0; $i<3; $i++) {
$html .= '<tr>'
for ($j=0; $j<3; $j++) {
$html .= '<td>';
$html .= '<img src="' . $imgs[$index++] . '">';
$html .= '</td>';
}
}
$html .= '</table>';
echo $html;
Hope that helps.
Laying out column images in a table
<? $perrow=3; $n=0; ?>
<table>
<? foreach($images as $i): ?>
<? if($n == 0): print '<tr>'; endif; ?>
<td><img src="<?=$i?>"></td>
<? if(++$n >= $perrow): print '</tr>'; $n = 0; endif; ?>
<? endforeach; ?>
</table>
<?php
$images=ARRAY( a.gif","b.jpeg","c.jif","d.bmp");
?>
<table border="0" cellspacing="1" cellpadding="0">
<tr>
<?php
for($i=0; $i< count($images); $i++) {
echo "<td>
<table width=100% border=0>
<tr><td>
<img src=Download/$images[$i] width=130 height=130 border=0></td></tr>
</table>
</td>";
if ( (($i+1) % 3) == 0 ) echo $newrow="</tr><tr>"; // change 6 to 8 and see
}
?>
</tr>
</table>