I have this bit of code that opens a file, reads it line by line, and
prints the filename into an image on screen, so i get a big list of
images on the page.
However I want it to output into a table so I can have 2 photos side by
side as it goes through, is there any way of manipulating the code to
output one line into one cell and the next line into the next cell then
back to the first cell again???
<?
$data = file('gallery/captions');
foreach ($data as $line)
{
list ($q, $a) = explode('|' , trim($line) );
echo "<img src='gallery/images/$q' height=100><br>";
echo "$a<br>";
}
?> 3 1699 <? $data = file('gallery/captions');
foreach ($data as $line) { list ($q, $a) = explode('|' , trim($line) ); echo "<img src='gallery/images/$q' height=100><br>"; echo "$a<br>"; }
?>
<?
$data = file('gallery/captions');
echo "<table border=1>";
foreach ($data as $line)
{
list ($q, $a) = explode('|' , trim($line) );
echo "<td><img src='gallery/images/$q' height=100><br>";
echo "$a</td>";
$ee++;
//2 - row
if($ee%2==0) echo "<tr>";
}
echo "</table>";
?>
--
Michal Wozniak
Michal Wozniak wrote: <? $data = file('gallery/captions');
foreach ($data as $line) { list ($q, $a) = explode('|' , trim($line) ); echo "<img src='gallery/images/$q' height=100><br>"; echo "$a<br>"; }
?>
<? $data = file('gallery/captions'); echo "<table border=1>"; foreach ($data as $line) { list ($q, $a) = explode('|' , trim($line) ); echo "<td><img src='gallery/images/$q' height=100><br>"; echo "$a</td>"; $ee++; //2 - row if($ee%2==0) echo "<tr>";
Tidier is
if($ee%2==0) echo "</tr><tr>"; } echo "</table>";
echo "</tr></table>";
Steve ?>
-- Michal Wozniak
matt wrote: I have this bit of code that opens a file, reads it line by line, and prints the filename into an image on screen, so i get a big list of images on the page.
However I want it to output into a table so I can have 2 photos side by side as it goes through, is there any way of manipulating the code to output one line into one cell and the next line into the next cell then back to the first cell again???
<? $data = file('gallery/captions');
foreach ($data as $line) { list ($q, $a) = explode('|' , trim($line) ); echo "<img src='gallery/images/$q' height=100><br>"; echo "$a<br>"; }
?>
Hi,
Just make the table:
<table border=1>
<?
$data = file('gallery/captions');
foreach ($data as $line)
{
list ($q, $a) = explode('|' , trim($line) );
?>
<tr>
<td>
<img src='gallery/images/<?= $q ?>' height=100>
</td>
<td>
<?= $a ?>
</td>
</tr>
<?
}
?>
</table>
Regards,
Erwin Moller This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bob |
last post by:
Everybody,
I've been doing a lot of on-line research and cannot find
any reference to the exact problem I'm having.
Let me preface this question with the fact that I'm coming
from an Oracle...
|
by: jaydog |
last post by:
Hello...
I'm new to XSL, and I've written a XSLT file that converts a XML file
to HTML format. When viewed in a browser, it appears exactly as I
would like. However, if I want to look at the...
|
by: Glenn |
last post by:
Hi!
Server info -
Win2K3 Server +SP1 with 1 GB Memory and 1.5 GB Virtual Memory
SQL Server 2000 Enterprise Edition + SP3 running on this.
Required result -
Create a SQL Script that will...
|
by: Poster |
last post by:
I have a script, its outputs are in HTML. It displays perferctly in a
browser, however when I view source, it gives me the JS scripts, but I want
to view the HTML output. Is there a way I can view...
|
by: laurenq uantrell |
last post by:
I'm using the function below to output all of my stored procedures into
a text file. Fice, except that the output file does not reflect the
names of the stored procedures correctly if the name has...
|
by: Wescotte |
last post by:
I'm writing a tiny php app that will log into our bank of america
account and retrieve a file containing a list of checks that cleared
the previous day. The problem I'm running into is when I...
|
by: tomblower |
last post by:
Access 2000 fully updated
Three PCs manage data held on a server. They each have a front-end mdb
file linked to tables on the server and on each PC.
A problem has arisen over the following line...
|
by: vishwa Ram |
last post by:
Hi all,
I want to replace a particular blocks only not in entire file. But I will give a new output file with replacement. Replacement should not affect other text
my $table;...
|
by: Okonita via DBMonster.com |
last post by:
Hi all,
I am comming along with all this Linus/DB2/scripting business...I am no
longer scared of it!! (LOL). But,
I need to create a .ksh script that does a REORGCHK and output only tables...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |