Jag har två php sidor som jag använder för att visa bilder.
thumbs.php och show.php
i thumbs.php så visas alla thumbs från en mapp - trycker man på en bild så kommer man till show.php
Jag skulle vilja att show.php kom upp i ett popupfönster istället.
Alla funktioner hämtas från en functions.inc
thumbs.php
function show_thumbs($cols, $th_width, $th_height, $cellpadding,
$cellspacing, $perpage)
{
$dir = $_GET["dir"];
$tot = count_files($dir);
if (isset($_GET["page"])) {
$page = $_GET["page"];
}
if (isset($_GET["img"])) {
$img = $_GET["img"];
}
global $showfilename;
global $hidefilenameext;
if ($page == NULL) {
$page = ceil($img / $perpage);
}
echo "<div style='text-align: center'>";
echo "<table border='0' cellpadding='$cellpadding'
cellspacing='$cellspacing' align='center'>\n";
echo "<tr>\n";
$filelist = list_files("./$dir/thumbs");
$n = 1;
$end = min(($page * $perpage), sizeof($filelist));
for ($i = (($page - 1) * $perpage); $i < $end; $i++)
{
echo "<td align='center'>\n";
echo "<table border='0' cellspacing='1' cellpadding='0'
bgcolor='#F8F8F8'>\n";
echo "<tr><td>\n";
echo "<a href='show.php?dir=$dir&tot=$tot&img=".($i + 1).
"&page=$page'>\n";
echo "<img src='$dir/thumbs/$filelist[$i]' width='$th_width'
height='$th_height' border='0'><br>\n";
echo "</a>\n";
echo "</td></tr>\n";
echo "</table>\n";
if ($showfilename)
{
if ($hidefilenameext) {
echo "<small>".substr($filelist[$i], 0, strrpos($filelist[$i], '.'))."</small>";
}
else
{
echo "<small>$filelist[$i]</small>";
}
}
echo "</td>\n";
if (($n % $cols) == 0 && ($n != $perpage))
{
echo "</tr>";
echo "<tr align='center'>";
}
$n++;
}
echo "</tr>\n";
echo "</table>";
// We need to show thumbs in more than one page
if (sizeof($filelist) > $perpage) {
echo ("Page: ");
for ($j = 1; $j <= ceil(sizeof($filelist) / $perpage); $j++) {
echo ("<a href='thumbs.php?dir=$dir&page=".$j."'>");
// Current page
if ($page == $j) {
echo "<b>".$j."</b>";
}
else
{
echo $j;
}
echo "</a>";
echo (" ");
}
echo "<br><br>";
}
echo "<a href='index.php'>Album</a> ";
echo "</div>";
}
Jo, det är så jag skulle gjort, med this.href (för att kunna öppna nya fönstret som man vill) och return false (för att inte basfönstret ska hoppa upp), om jag behöver öppna ett litet fönster, oavsett språk sidan är gjord i.
Reservation alltså för att php/andra språk skulle ha egna trix, men så kan det väl inte vara, det är ju ett klientspråk som behövs?
255 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849