Ich hab eine Bilderhomepage mit gallerien :
http://www.****.net/index.php?page=bilder/0018/index.php
[Domain veraltet]
nun sollte unter dem dateinamen ein link sein der zu den vorhanden Kommentaren führt und zum formular zum eintragen !
unter den Thumbnails sollte auch noch angezeigt werden ob bereits kommentare hinerlassen wurden !
Meine Gallerie ist mit folgendem Script aufgebaut das die Bilddateien ausliest :
// *************************************************************************** ********************//
// phpMyDIR
// *************************************************************************** ********************//
require("seiten/class.dir.php");
$DIR = new myDIR;
$DIR->setMASK("*.*"); // (".*") separated with comma
$DIR->setFIND("all"); // could be "folder" "files" "all"
$DIR->setROOT("bilder/0015/low"); // start folder
$RESULT = $DIR->getRESULT();
echo "
n";
echo " | | | |
";
//echo "Es wurden ".count($RESULT)." Dateien gefunden. |
n";//
for ( $i=0 ; $i < count($RESULT); $i++ )
{
$save1 = ( $i%2 == 0 ) ? "" : " ";
$save2 = ( $i%2 == 0 ) ? "" : "
";
echo $save1;
echo " ".$RESULT[$i]["file"]." | ";
echo " | ";
echo $save2;
}
echo "
n";
?>
Naja vielleicht bekommts ja jemand hin. !
Hier noch die Datei "class.dir.php"
// *************************************************************************** ********************//
// CLASS myDIR
// *************************************************************************** ********************//
/*
* INFO:
* this script reads a specified dir and
* return a array with $folder $file $size $time
* needs PHP4 or higher
*
* AUTHOR & COPYRIGHT (C):
* alexander klein
*
http://www.alexanderklein.de
*
mail@alexanderklein.de
*
* RELEASE:
* version 1.1 (24-02-2002)
*
* THANKS TO CARLOS FOR THE OPTION TO INCLUDE MORE THAN ONE EXTENSION.
* carlos pires
http://www.osbrasil.org
*
* USAGE:
*
*************************************************************************** ***********************
require("./class.dir.php");
$DIR = new myDIR;
$DIR->setMASK("*.php,*.html,*.txt"); // ("*.html,*.htm,*.txt") separated with comma
$DIR->setFIND("files"); // could be "folder" "files" "all"
$DIR->setROOT("./phpMyAdmin"); // start folder
$RESULT = $DIR->getRESULT();
echo "
n";
echo "Found ".count($RESULT)." |
n";
for ( $i=0 ; $i < count($RESULT); $i++ )
{
$bgcolor = ( $i%2 == 0 ) ? "#DDDDDD" : "#EFEFEF";
echo "";
echo " ".$RESULT[$i]["folder"]." | ";
echo " ".$RESULT[$i]["file"]." | ";
echo " ".$RESULT[$i]["size"]." | ";
if ($RESULT[$i]["time"])
{
echo "".strftime("%d.%m.%y - %H:%M",$RESULT[$i]["time"])." | ";
}
else
{
echo " | ";
}
echo "
n";
}
echo "
n";
*************************************************************************** ***********************
*
* CHANGELOG
*
* 24.02.2002 - added natcasesort
* - added option to include more than on extension
*
*************************************************************************** ***********************
*
*/
class myDIR
{
var $mask = "";
var $find = "";
var $root = array();
var $temp = array();
var $result = array();
//** setFIND *************************************************************************** *****//
function setFIND($val)
{
$this->find = $val;
}
//** setMASK *************************************************************************** *****//
function setMASK($val="")
{
$this->mask = $val;
}
//** setROOT *************************************************************************** *****//
function setROOT($val="")
{
$this->root[] = $val;
}
// *************************************************************************** *****************//
//** setARRAY *************************************************************************** *****//
function setARRAY($folder="",$file="",$size="",$time="")
{
$this->result[] = array("folder"=>$folder,"file"=>$file,"size"=>$size,"time"=>$time);
}
//** doSEARCH *************************************************************************** *****//
function doSEARCH()
{
for($i=0; $i
root); $i++)
{
unset($this->temp);
$handle = @opendir($this->root[$i]);
while ($file = @readdir ($handle))
{
if (eregi("^.{1,2}$",$file))
{
continue;
}
$this->temp[] = $this->root[$i]."/$file";
}
@closedir($handle);
if (count($this->temp) > 0)
{
natcasesort($this->temp);
foreach ($this->temp as $val)
{
switch ($this->find)
{
case "folder":
$this->doFOLDER($val);
break;
case "files":
$this->doFILES($val);
break;
case "all":
$this->doFILES($val);
$this->doFOLDER($val);
break;
}
}
}
}
}
//** doFOLDER *************************************************************************** *****//
function doFOLDER($val)
{
if( is_dir($val) )
{
if ($this->find == "all")
{
$this->root[] = $val;
}
}
}
//** doFILES *************************************************************************** *****//
function doFILES($val)
{
if( is_file($val) && $this->doMATCH($val) )
{
$this->doINFO($val);
}
}
//** doINFO *************************************************************************** ******//
function doINFO($val)
{
$fSIZE = filesize($val);
$fTIME = filemtime($val);
$offset = strrpos ($val, "/");
$folder = substr ($val, 0, $offset);
$file = substr ($val, $offset+1);
$this->setARRAY($folder,$file,$fSIZE,$fTIME);
}
//** getRESULT *************************************************************************** *****//
function doMATCH($file)
{
$mask = $this->mask;
$mask = str_replace(".", ".", $mask);
$mask = str_replace("*", "(.*)", $mask);
$mask_array = explode(',',$mask);
foreach ($mask_array as $valid)
{
if(eregi("^$valid", $file, $geek))
{
return true;
}
}
}
//** getRESULT *************************************************************************** *****//
function getRESULT()
{
$version = split (".", phpversion());
if ( $version < 4 )
{
echo "ERROR: phpMyAdmin does only works with PHP-Versions 4.0 or higher.n
";
echo "Your Version is (".phpversion().").";
exit;
}
$this->doSEARCH();
if ( !$this->result )
{
echo "ERROR: No Data or Folder does not exist (".$this->root.")";
exit;
}
return $this->result;
}
// *************************************************************************** ****************//
}
// *************************************************************************** ********************//
?>
Nachtrag :
Unter den Thumbnails sollte also ein link sein der zu den kommentaren führt.
Sollte in etwa so lauten
kommentare.php?pic=0001-0018
dann sollte er die datei 0001-0018.dat anlegen ! und darin die kommentare speichern !
Kein SQL wenns geht !