scriptygoddess

30 Aug, 2002

Photolog multiple columns…

Posted by: Jennifer In: Scripts

Was reminded of this script by looking through my referrers… had forgotten about it. Wanted to post it here so I don't lose it again. :)

The following script is really designed for a photo log… it will set up your page (MT specific) so that it automatically generates a table with 3 columns (You can actually customize it to be however number of columns you choose…

Javascript version:
<script language="javascript">
<!–
// number of columns
var numColmax = 3;

var numCol = 1;
var done=false;
//–>
</script>
<table width="400" border=1 cellspacing=3 cellpadding=0>
<MTEntries>
<script language="javascript">
<!–
if (numCol == 1) {
document.write("<tr>");
}
//–>
</script>
<td>
<a href="<$MTEntryLink$>">
<$MTEntryTitle$>
<br>
<$MTEntryExcerpt$>
</a>
</p>
</td>
<script language="javascript">
<!–
numCol++
done = false

if (numCol > numColmax) {
document.write("</tr>");
numCol=1;
done = true;
}
//–>
</script>
</MTEntries>

<script language="javascript">
<!–
if (!(done)) {
for (i=0; numCol <= numColmax; i++ )
{
document.write("<td> </td>")
numCol++
}
}
if ((numCol >= numColmax) && !(done)) {
document.write("</tr>")
}
//–>
</script>
</table>

————————

PHP version:
<?
// number of columns
$numColmax = 3;

$numCol = 1;
$done=false;
?>
<table width="400" border=1 cellspacing=3 cellpadding=0>
<MTEntries>
<?
if ($numCol == 1) { ?>
<tr>
<? } ?>
<td>
<a href="<$MTEntryLink$>">
<$MTEntryTitle$>
<br>
<$MTEntryExcerpt$>
</a>
</p>
</td>
<?
$numCol++;
$done = false;

if ($numCol > $numColmax) { ?>
</tr>
<?
$numCol=1;
$done = true;
} ?>

</MTEntries>

<?
if (!($done)) {
for ($i=0; $numCol <= $numColmax; $i++ )
{ ?>
<td> </td>
<?
$numCol++;
}
}
if (($numCol >= $numColmax) && !($done)) {
?>
</tr>
<? } ?>
</table>

10 Responses to "Photolog multiple columns…"

1 | ste

September 2nd, 2002 at 12:49 am

Avatar

Rock on!! I've been thinking about making categories for my photolog and was curious how to go about putting the thumbnails in a little more tabled layout :) Thank you for saving me the extra hours of frustration of having to think this code out myself 😉

2 | stepan

January 29th, 2003 at 8:23 am

Avatar

You can use the MTGrid plugin to create tables without JavaScript or PHP programming.

3 | rena

January 29th, 2003 at 8:08 pm

Avatar

i am trying this code and it will not show anything past the first row…does it extend? ie i have 4 entries and a 3-column layout and i only see my first 3 entries..the 4th has disappeared!

4 | Coyote

July 10th, 2003 at 2:33 pm

Avatar

Okay, I'm thoroughly lost here. I have this scriipt (in PHP form) working perfectly on one page:

http://haloandhorns.com/f16/archives.php

Here is the txt file:
http://haloandhorns.com/f16/debug/archiving.txt

But then on this second page (different site) I cannot get it working.

http://bluewyrmartwerks.com/archives.php

Here is the txt file:
http://bluewyrmartwerks.com/debug/archiving.txt

Its driving me batty, and if you happen to see something I'm missing, I'll be very happy! 😀

5 | david

March 29th, 2004 at 9:21 am

Avatar

Does it work with Rows as well?
I need 5 cols and 2 rows (10 images per page)
is that possible?

Does it integrate with MTPaginate?
I tried MTGrid but it doesn't seem to integrate with MTpaginate.

6 | ETC. Indulging my inner geek

November 10th, 2002 at 9:22 am

Avatar

Table generating script
This script from scriptygoddess is very handy and I wanted to bookmark it here as well. While originally intended to

7 | Electrosketch!

February 25th, 2003 at 11:31 pm

Avatar

What scripts and plug-ins do you use with Movable Type?
If it weren't for the generous people who share their code, this site would have long ago lost it's fizz. The related resources to the right list all the script sources I've used on this site at one time or another. Related resources: myimages/bulletg…

8 | Useless Internet

October 6th, 2003 at 6:34 pm

Avatar

I think today my lomo
I think today my lomo is going to come. And this weekend in Georgia is sales tax holiday. I think we all know that a new scanner is in my future. I was inspired to get the lomo by a.life.uncommon….

9 | Useless Internet

November 15th, 2003 at 6:05 am

Avatar

Lomo Time
I think today my lomo is going to come. And this weekend in Georgia is sales tax holiday. I think we all know that a new scanner is in my future. I was inspired to get the lomo by a.life.uncommon….

10 | Electrosketch!

December 28th, 2003 at 12:09 pm

Avatar

What code resources do you use?
The JavaScript Source is a great place to find javascript resources and Scripty Goddess is a goldmine of PHP and other scripts tailored for the movable type environment. Also, another good source for tips is Girlie Matters. You may also want to check o…

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements