Photolog multiple columns…

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 Says:

    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. ETC. Indulging my inner geek Says:
    Table generating script
    This script from scriptygoddess is very handy and I wanted to bookmark it here as well. While originally intended to

  3. stepan Says:

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

  4. rena Says:

    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!

  5. Electrosketch! Says:
    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…

  6. Coyote Says:

    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! :D

  7. Useless Internet Says:
    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….

  8. Useless Internet Says:
    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….

  9. Electrosketch! Says:
    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…

  10. david Says:

    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.