Michael G.: Bei php variablen übergeben...

also, ich habe hier jetzt zwei php dateien... der einfachheit halber werde ich die jetzt mal hier posten...

erste datei (galerie.php):

<?php

if (empty($menuefile)) $menuefile = "./menue.nav";
if (empty($heading1)) $heading1 = "nodata";
$heading2=$heading1;
if (empty($heading2)) $heading2 = "nodata";

echo "<html><head>\n";
echo "<link href="./style.css" rel="stylesheet" type=text/css>\n";
echo "<script language="JavaScript">function zoom_img() {";
echo "var param="dependent=yes,hotkeys=no,locationbar=no,menubar=no,status=no,resizable=yes";";
echo "F1=window.open("show_img.php?directory=$directory&picact=$picact","Zoom",param);}</script>\n";
echo "<title>--==[ ::Galerie::$heading1:: ]==--</title>\n";
echo "</head><body>\n";

echo "<table width=95% align=center border=0 cellpadding=0 cellspacing=0>\n";

echo "<caption><div class=headline>";
echo "$heading2";
echo "</div><hr></caption>\n";

echo "<tr><td style="width: 175px; table-layout: fixed; vertical-align: top">\n";
include("$menuefile");
echo "\n</td><td width=2px bgcolor="#3399CC"></td>\n";

echo "<td width=5px> </td><td valign=top>\n";

echo ("<table border=0 cellpadding=0 cellspacing=8 width=100%>\n");
echo ("<tr>\n\n");

for($picact=1;$picact<=$picno;$picact++)
{

echo ("<td>\n");
echo ("  <table border=0 cellpadding=0 cellspacing=0 width=102>\n");
echo ("    <tr><td height=20 class=cont1>\n");
echo ("         bild" . $picact . "\n");
echo ("    </td></tr>\n");
echo ("    <tr><td class=cont2 height=102>\n");
echo ("        <div style="text-align: justify;"><a href="javascript:zoom_img();"><img src="$directory/pre/" . $picact . "pre.jpg"></a></div>\n");
echo ("    </td></tr>\n");
echo ("    <tr><td class=cont1>\n");
echo ("      <div style="text-align: center;"><img src="../pics/p.gif" border=0 height=1 width=1 alt=""></div>\n");
echo ("    </td></tr>\n");
echo ("  </table>\n");
echo ("</td>\n");

if ( !($picact % 4))
{echo ("</tr><tr>\n");}

}

echo ("</tr>\n");
echo ("</table>\n");

echo "</td></tr></table>\n";
echo "</body></html>\n<noscript><noscript><plaintext>";

?>

die zweite datei (show_img.php ist:

<?php

echo ("<html><head>");
echo ("<script language="JavaScript">");
echo ("function chkimg() {");
echo ("  if (document.zimg.complete==true){");
echo ("    window.resizeTo(document.zimg.width+10,document.zimg.height+28);}");
echo ("  else {");
echo ("    window.setTimeout('chkimg()',250);");
echo ("  }");
echo ("}");
echo ("</script></head>");

echo ("<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad="javascript:chkimg()">");
echo ("<img src="$directory/$picact.jpg" border="0" name="zimg">");
echo ("</body></html>");

?>

soweit funktioniert da alles.... nur wird leider aus der ersten datei nicht die variable picact übergeben.... die brauche ich aber in der zweiten...

kann mir jemand sagen, wie ich das anstelle?

Michael

PS: bitte auch auf andere fehler aufmerksam machen... ich bin noch anfänger in php.

  1. Hallo Michael!

    echo "<script language="JavaScript">function zoom_img() {";
    echo "var param="dependent=yes,hotkeys=no,locationbar=no,menubar=no,status=no,resizable=yes";";
    echo "F1=window.open("show_img.php?directory=$directory&picact=$picact","Zoom",param);}</script>\n";

    <a href="javascript:zoom_img();"><img src="$directory/pre/" . $picact . "pre.jpg"></a>

    [...] variable picact übergeben....

    erstmal, den ganzen code hätts ja net gebraucht ... 2 .phps auf nem Server wär evtl. geshcickter gewesen..

    Ich weiß net, ob des was ich sag wirklich stimmt, aber ich seh grad net, woher die JS-Funktion ein richtiges picact bekommen sollte ... ich würd's im a als Argument mitübergeben...

    MfG
    Götz