Seite 2 von 4

Verfasst: Do 17. Okt 2002, 20:21
von Sven777b
Hi Jacke,

vielleicht kann ich dir weiterhelfen... immerhin ist die Navi von mir ;)
Leider stehe ich momentan tierisch im Stress und hab erst in 3-4 Tagen wieder Zeit. (man merkt, das ich so selten poste *lol*)
Ich musste mich heute sowieso mit front_frame beschäftigen , weil berlingo ein Problem hatte (geklärt) aber nu verstehe ich auch front_frame...
werde mir demnächst eines einrichten und dann testen.
Hast du einen Messenger wie AIM, ICQ o.ä. ?

Verfasst: Do 17. Okt 2002, 20:26
von jacke
Beschäftige mich auch schon lange mit front_frame, träume schon davon, verstehe aber nichts.

Nein so neumodische Sachen hab ich nicht.

Schicke dor aber mal meine eMail per PM


schönen Abend

Verfasst: Mi 23. Okt 2002, 14:26
von ekke
Veränderung:automatische Buttongenerierung
1.) Ordner anlegen im z.B. front_single:
ttf/
und da hinein ein verdana.ttf aus z.B. c:\windoof\font\verdana.ttf
2.) in Ordner js/standart.js dieses hier:
Die Javascripte sind die von Marcomed, wenn Ihr keinen DW habt, dann müßt Ihr wohl andere nehmen ;-) :

Code: Alles auswählen

function MM_callJS(jsStr) {
  return eval(jsStr)
}

function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function preload(imgObj,imgSrc) {
    if (document.images) {
        eval(imgObj+' = new Image()')
        eval(imgObj+'.src = "'+imgSrc+'"')
    }
}
In das Layout kommt in den bodytag:

Code: Alles auswählen

<?php

function show_dir($dir, $pos=2)
{
     if($pos == 2)
     {
        $JScontent = "MM_preloadImages(";
           }

     $handle = @opendir($dir);
     while ($file = @readdir ($handle))
     {
        if (eregi("^\.{1,2}$",$file))
        {
          continue;
        }

     if(is_dir($dir.$file))
        {
          }
        else
        {
     
      $preg_matchvar = preg_match("/CCCCCC/i", $file);
      if ($preg_matchvar == "1"){
        
         $JScontent .= "'".$file."'";
     

      }
        }

     }

     @closedir($handle);

     if($pos == 2)
     {
         $JScontent .= ");";

     }
$JScontentRP = str_replace ( "''", "','", $JScontent);
echo $JScontentRP;
}

show_dir("img_site/menubuttons/");

?>
und an den Ort, wo das Menü erscheinen soll:

Code: Alles auswählen

<?php
//-----------------------------------------------------------------------------//
$nav_start = "3"; // Startbaum festlegen
//$nav_col_out = "#6699FF"; // Zellfarbe normal
//$nav_col_over = "#9999FF"; // Zellfarbe Mouse-Over
//$nav_col_back = "#6600FF"; // Hintergrundfarbe (Einzug)
//$nav_col_on  = "font13"; // Farbmarkierung aktiv
//$nav_col_off = "font11"; // Farbmarkierung passiv
$nav_col_on  = "FF0000"; // Farbmarkierung aktiv
$nav_col_on_hover  = "CCCCCC"; // Farbmarkierung aktiv hover
$nav_col_off = "000000"; // Farbmarkierung passiv
$nav_col_off_hover = "CCCCCC"; // Farbmarkierung passiv hover
$nav_button_folder = "img_site/menubuttons/";  // Ort der Buttons
$nav_button_img_ext = ".png"; // Art der Buttons je nach Provider/gdlib: .png, .gif, .jpg
$bg = "FFFFFF"; // Hintergrundfarbe Buttons

//-----------------------------------------------------------------------------//


// offenen Pfad finden //
$nav_path = array(); $nav_tree = array();
$tmp_idcat = $idcat;
while($tmp_idcat > 0){
  array_push($nav_path, $tmp_idcat);
  $tmp_idcat = $con_tree[$tmp_idcat][parent];
};
$nav_path = array_reverse($nav_path);
// gegen Verlassen des Baumes schützen:
if($nav_path[0] != $nav_start){$nav_path = array($nav_start);};
// Baum sortieren //
for($i = 0;$i < sizeof($nav_path);$i++){
  $tmp_found=0;
  for($nr = 0; $nr <= $con_tree_max; $nr++){
    if($con_tree[$nr][parent] == $nav_path[$i] && $con_tree[$nr][preid] == '0'){$tmp_found=1;break;}
  }
  unset($tmp_level);$tmp_level = array();
  do{
    array_push($tmp_level , $nr);
    $nr = $con_tree[$nr][postid];
  } while($nr != '0' && $tmp_found==1);
  if($i == 0){$nav_tree = $tmp_level;}
  else {
    $x = array_search("$nav_path[$i]", $nav_tree);
    array_splice($nav_tree, $x+1, 0, $tmp_level);
  };
};
// Baum ausgeben //

echo "<table  cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
foreach($nav_tree as $nr){

   if(($con_tree[$nr][public] == '1' or $auth->auth["uid"] != "nobody") and $con_tree[$nr][visible] == '1'){
unset($mod_space);$mod_space = array();
    $mod_space = array_pad($mod_space,($con_tree[$nr][level] - 1),"&nbsp;&nbsp;");
    echo "<tr><td valign=\"top\" nowrap>".implode("",$mod_space);

    echo "<a href=\"".$con_tree[$nr][link]."\"";

     
if($nr == $idcat){      
      $nav_button_image = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_on.$nav_button_img_ext;
                  if (!file_exists ($nav_button_image)) {
                  MakeImage ($bg, $nav_col_on, $con_tree[$nr][titel], $nav_button_image, $nav_button_img_ext);
                  }
      $nav_button_img_hover = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_on_hover.$nav_button_img_ext;
                  if (!file_exists ($nav_button_img_hover)) {
                  MakeImage ($bg, $nav_col_on_hover, $con_tree[$nr][titel], $nav_button_img_hover, $nav_button_img_ext);
                  }
} else {     
      $nav_button_image = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_off.$nav_button_img_ext;
                   if (!file_exists ($nav_button_image)) {
                   MakeImage ($bg, $nav_col_off, $con_tree[$nr][titel], $nav_button_image, $nav_button_img_ext);
                   }
      $nav_button_img_hover = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_off_hover.$nav_button_img_ext;
                   if (!file_exists ($nav_button_img_hover)) {
                   MakeImage ($bg, $nav_col_off_hover, $con_tree[$nr][titel], $nav_button_img_hover, $nav_button_img_ext);
                   }

};

   echo "  onMouseOut=\"MM_swapImgRestore()\"  onMouseOver=\"MM_swapImage('".$nav_button_image."','','".$nav_button_img_hover."',1)\"";
   echo ">";
 echo "<img name=\"".$nav_button_image."\" src=\"".$nav_button_image."\" border=\"0\"alt=\"".$con_tree[$nr][titel]."\"></a>";
 echo "</td></tr>\n";

  };
};
unset($nav_tree);unset($nav_path);
echo "</table>";

 function ConvertColor($hexVal){
    $ColorVal = array(3);
    for($i = 0; $i < 3; $i++)
      $ColorVal[$i] = HexDec(substr($hexVal, $i * 2, 2));
    return $ColorVal;
  }
   function MakeImage($bg, $fg, $txt, $image, $nav_button_img_ext){
  $width = 200;
  $offset = 10;
$imgFRAME = ImageCreate($width, $offset);

  list($red, $green, $blue) = ConvertColor($bg);
  $bgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

  list($red, $green, $blue) = ConvertColor($fg);
  $fgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

imagettftext($imgFRAME, 12,0,2,15,$fgCOLOR,"ttf/verdana.ttf",$txt);
if ($nav_button_img_ext == ".png") {
  ImagePng($imgFRAME, $image);
  }
  if ($nav_button_img_ext == ".gif") {
  ImageGif($imgFRAME, $image);
  }
  if ($nav_button_img_ext == ".jpg") {
  ImageJPG($imgFRAME, $image);
  }
  ImageDestroy($imgFRAME);
 }
?>
credits:
sven777 für das Urmenü
http://www.koehtopp.de für das Directorylisting
und das Urbutton.php, dass Ihr hier nicht mehr braucht:

Code: Alles auswählen

<?php
// -----------------------------------------------------------------------------------------------
// button.php
// -----------------------------------------------------------------------------------------------
// Project:   Cascading menu with image buttons using on-the-fly image creation.
// Author:    Copyright (c) Urs <admin@circle.ch>
// Version:   1.0.0
// Update:    20-7-2000
// Licence:   ?
// PHP:       php-4.0.0-win32
//
// Source:    http://www.circle.ch/scripts/code/button_menu.zip
// Reference: "menu class" written by:                  <zakj@i.am>,
//            modified "menu class" for image use by:   <admin@circle.ch>
// Syntax:    for testing:
//               http://localhost/nested_menu.php
//            for inclusion (see also nested_menu.php):
//               <img src="button.php?fg=990000&bg=ffffff&txt=button one" border="0" alt="">
// Settings:  $bg = background color , hexadecimal
//            $fg = foreground color , hexadecimal
//            hexadecimal order : RGB (each 2byte)
//
// Enjoy!
// -----------------------------------------------------------------------------------------------
// Be aware of the patented GIF format! Adapt the routines to PNG. <http://www.libpng.org/pub/png>
// -----------------------------------------------------------------------------------------------

  define("TextFONT", "3");

  function ConvertColor($hexVal){
    $ColorVal = array(3);
    for($i = 0; $i < 3; $i++)
      $ColorVal[$i] = HexDec(substr($hexVal, $i * 2, 2));
    return $ColorVal;
  }

  //$width = strlen($txt) * ImageFontWidth(TextFONT);
  $width = 110;
  $offset = 2;
  $imgFRAME = ImageCreate($width, ImageFontHeight(TextFONT)+$offset);

  list($red, $green, $blue) = ConvertColor($bg);
  $bgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

  list($red, $green, $blue) = ConvertColor($fg);
  $fgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

  ImageFill($imgFRAME, 1, 1, $bgCOLOR);
  ImageString($imgFRAME, TextFONT, 1, 1, $txt, $fgCOLOR);

  header("Content-type: image/png");
  ImagePNG($imgFRAME);
  ImageDestroy($imgFRAME);
 
?>
Viel Spass
Gruss ekke

Verfasst: Do 24. Okt 2002, 10:05
von jacke
Hallo ekke,

war wohl dan doch nur, und nicht z.B., front_single,

oder hab ich etwas falsch verstanden.

Das in das Layout (body):
<?php

function show_dir($dir, $pos=2)
{
if($pos == 2)
{
$JScontent = "MM_preloadImages(";
}

$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
.........usw.


Das in die standart.js:

function MM_callJS(jsStr) {
return eval(jsStr)
}

function MM_swapImgRestore() {
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}

.....usw.


Das in den left_frame:

<?php
//-----------------------------------------------------------------------------//
$nav_start = "3"; // Startbaum festlegen
//$nav_col_out = "#6699FF"; // Zellfarbe normal
//$nav_col_over = "#9999FF"; // Zellfarbe Mouse-Over
//$nav_col_back = "#6600FF"; // Hintergrundfarbe (Einzug)
//$nav_col_on = "font13"; // Farbmarkierung aktiv
//$nav_col_off = "font11"; // Farbmarkierung passiv
.....usw.

Das ebenfalls in den left_frame:

<?php
// -----------------------------------------------------------------------------------------------
// button.php
// -----------------------------------------------------------------------------------------------
// Project: Cascading menu with image buttons using on-the-fly image creation.
// Author: Copyright (c) Urs <admin@circle.ch>
// Version: 1.0.0
// Update: 20-7-2000
...usw.



So wie ich es eingefügt habe - keine Navi mehr.


Hab ich es nicht korrekt integriert oder ist es nur für single.


Gruß

Jacke

Verfasst: Do 24. Okt 2002, 10:43
von ekke
also:
alle ordner angelegt? verdana.ttf da?
Auf server unterstütztes Imageformat eingestellt:
$nav_button_img_ext = ".png"; // Art der Buttons
$nav_start = "1"; // Startbaum festlegen eigestellt?
ordner img_site/menubuttons/ Recte 777 ?

Das Button.php wird nicht gebraucht.

Das
<?php

function show_dir($dir, $pos=2)
{
if($pos == 2)
{
$JScontent = "MM_preloadImages(";
}

$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
.........usw.
in den bodytag, es liest einfach das Verzeichnis, damit man die Bilder für den preload bekommt. Ist erstmal nicht wichtig.
Hintergrund: der javascript onload-Befehl geht nur im <body> oder <frame> tag ( http://selfhtml.teamone.de )


Das in den left_frame:


kommt in den Leftframe

Code: Alles auswählen


 <?php
include("config.php");
include($ContenidoPath."inc/config.php");

page_open(
    array("sess" => "Contenido_Session",
          "auth" => "Contenido_Frontend_Challenge_Crypt_Auth",
          "perm" => "Contenido_Perm"));

include($ContenidoPath.$cfgPathInc."cfg_sql.inc.php");


$db = new DB_Contenido;


?>



<html>
<head>
<style>
<!--
a {font-size: 11px; color: black; font-family: Verdana; text-decoration: none}

-->
</style>


</head>
<body bgcolor="white">

<?php
// Gruppen einlesen //

$sql = "SELECT A.idcat, A.parentid, A.preid, A.postid, B.name, B.public, B.visible, C.level FROM $cfgTab_cat AS A, $cfgTab_cat_lang AS B, $cfgTab_cat_tree AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND A.idclient='$client' AND B.idlang='$lang'";
$db->query($sql);
while($db->next_record()){
  $con_tree[$db->f("idcat")][parent]  = $db->f("parentid");
  $con_tree[$db->f("idcat")][preid]  = $db->f("preid");
  $con_tree[$db->f("idcat")][postid]  = $db->f("postid");
  $con_tree[$db->f("idcat")][titel]  = $db->f("name");
  $con_tree[$db->f("idcat")][public]  = $db->f("public");
  $con_tree[$db->f("idcat")][visible]  = $db->f("visible");
  $con_tree[$db->f("idcat")][level]  = $db->f("level");
  $con_tree[$db->f("idcat")][link]  = $sess->url("front_content.php?client=".$client."&lang=".$lang."&parent=".$db->f("parentid")."&idcat=".$db->f("idcat")."");
  if($db->f("idcat") > $con_tree_max){$con_tree_max = $db->f("idcat");}
};

//-----------------------------------------------------------------------------//
$nav_start = "1"; // Startbaum festlegen
$nav_col_out = "#6699FF"; // Zellfarbe normal
$nav_col_over = "#9999FF"; // Zellfarbe Mouse-Over
$nav_col_back = "#6600FF"; // Hintergrundfarbe (Einzug)
//$nav_col_on  = "font13"; // Farbmarkierung aktiv
//$nav_col_off = "font11"; // Farbmarkierung passiv
$nav_col_on  = "FF5A00"; // Farbmarkierung aktiv
$nav_col_on_hover  = "FF5A00"; // Farbmarkierung aktiv hover
$nav_col_off = "9C9C9C"; // Farbmarkierung passiv
$nav_col_off_hover = "5C5C5C"; // Farbmarkierung passiv hover
$nav_button_folder = "img_site/menubuttons/";  // Ort der Buttons
$nav_button_img_ext = ".png"; // Art der Buttons
$bg = "FFFFFF"; // Hintergrundfarbe Buttons

//-----------------------------------------------------------------------------//


// offenen Pfad finden //
$nav_path = array(); $nav_tree = array();
$tmp_idcat = $idcat;
while($tmp_idcat > 0){
  array_push($nav_path, $tmp_idcat);
  $tmp_idcat = $con_tree[$tmp_idcat][parent];
};
$nav_path = array_reverse($nav_path);
// gegen Verlassen des Baumes schützen:
if($nav_path[0] != $nav_start){$nav_path = array($nav_start);};
// Baum sortieren //
for($i = 0;$i < sizeof($nav_path);$i++){
  $tmp_found=0;
  for($nr = 0; $nr <= $con_tree_max; $nr++){
    if($con_tree[$nr][parent] == $nav_path[$i] && $con_tree[$nr][preid] == '0'){$tmp_found=1;break;}
  }
  unset($tmp_level);$tmp_level = array();
  do{
    array_push($tmp_level , $nr);
    $nr = $con_tree[$nr][postid];
  } while($nr != '0' && $tmp_found==1);
  if($i == 0){$nav_tree = $tmp_level;}
  else {
    $x = array_search("$nav_path[$i]", $nav_tree);
    array_splice($nav_tree, $x+1, 0, $tmp_level);
  };
};
// Baum ausgeben //

echo "<table width=\"160\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";

foreach($nav_tree as $nr){

   if(($con_tree[$nr][public] == '1' or $auth->auth["uid"] != "nobody") and $con_tree[$nr][visible] == '1'){
unset($mod_space);$mod_space = array();
    $mod_space = array_pad($mod_space,($con_tree[$nr][level] - 1),"&nbsp;&nbsp;");
    echo "<tr><td valign=\"top\" nowrap>".implode("",$mod_space);


    echo "<a href=\"".$con_tree[$nr][link]."\"";


if($nr == $idcat){
      $nav_button_image = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_on.$nav_button_img_ext;
                  if (!file_exists ($nav_button_image)) {
                  MakeImage ($bg, $nav_col_on, $con_tree[$nr][titel], $nav_button_image, $nav_button_img_ext);
                  }
      $nav_button_img_hover = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_on_hover.$nav_button_img_ext;
                  if (!file_exists ($nav_button_img_hover)) {
                  MakeImage ($bg, $nav_col_on_hover, $con_tree[$nr][titel], $nav_button_img_hover, $nav_button_img_ext);
                  }
} else {
      $nav_button_image = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_off.$nav_button_img_ext;
                   if (!file_exists ($nav_button_image)) {
                   MakeImage ($bg, $nav_col_off, $con_tree[$nr][titel], $nav_button_image, $nav_button_img_ext);
                   }
      $nav_button_img_hover = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_off_hover.$nav_button_img_ext;
                   if (!file_exists ($nav_button_img_hover)) {
                   MakeImage ($bg, $nav_col_off_hover, $con_tree[$nr][titel], $nav_button_img_hover, $nav_button_img_ext);
                   }

};

   echo "  onMouseOut=\"MM_swapImgRestore()\"  onMouseOver=\"MM_swapImage('".$nav_button_image."','','".$nav_button_img_hover."',1)\"";
   echo ">";
 echo "<img name=\"".$nav_button_image."\" src=\"".$nav_button_image."\" border=\"0\"alt=\"".$con_tree[$nr][titel]."\"></a>";
 echo "</td></tr>\n";

  };
};
unset($nav_tree);unset($nav_path);
echo "</table>";

 function ConvertColor($hexVal){
    $ColorVal = array(3);
    for($i = 0; $i < 3; $i++)
      $ColorVal[$i] = HexDec(substr($hexVal, $i * 2, 2));
    return $ColorVal;
  }
   function MakeImage($bg, $fg, $txt, $image, $nav_button_img_ext){
  $width = 140;
  $offset = 20;
$imgFRAME = ImageCreate($width, $offset);

  list($red, $green, $blue) = ConvertColor($bg);
  $bgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

  list($red, $green, $blue) = ConvertColor($fg);
  $fgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

imagettftext($imgFRAME, 10,0,2,15,$fgCOLOR,"ttf/verdana.ttf",$txt);
if ($nav_button_img_ext == ".png") {
  ImagePng($imgFRAME, $image);
  }
  if ($nav_button_img_ext == ".gif") {
  ImageGif($imgFRAME, $image);
  }
  if ($nav_button_img_ext == ".jpg") {
  ImageJPG($imgFRAME, $image);
  }
  ImageDestroy($imgFRAME);
 }
?>
</body>
</html>

Bei mir gehts wunderbar von oben ab.

Hoffe es hilt, ekke

Verfasst: Do 24. Okt 2002, 20:59
von jacke
Wie schon erwähnt weiß ja nun mein left_frame immer noch nicht wo ich nun gerade bin. Es müsste also vom Mainframe neu geladen werden und sicher mit dem Schnippsel:

xxxx...'demo_left.php?client=<?php echo $client; ?>&lang=<?php echo $lang; ?>&idcat=<?php echo $idtree; ?>"


aber was schreibe ich für xxxx? onload funzt nicht.


Kann jemand helfen?

Jacke

Verfasst: Do 24. Okt 2002, 22:06
von ekke
da war doch schon das javascript für den Wechsel von 2 Frames drin,
bei onclick wird das ausgeführt. Im Original ist das so:

Code: Alles auswählen

<script language="JavaScript">
function moveit(place1, place2) {
        if (parent.frames[1].location.href != place1) {
                                                        parent.frames[1].location.href = place1;
                                                       }
        if (parent.frames[2].location.href != place2) {
                                                        parent.frames[2].location.href = place2;
                                                      }
                                  }
</script>

und anpassen!!!!! der Link

Code: Alles auswählen

<a href=\"#\" onClick=\"moveit('demo_left.php?client=$client&parent=$key&lang=$lang&sub=yes', 'front_content.php?client=$client&lang=$lang&idcat=$key')\">

dann werden der content und der left gewechselt. Oben brauchst du die Navigation nicht, ist ja alles im left.

Gruss ekke

Verfasst: Fr 25. Okt 2002, 05:59
von idea-tec
du muss nun nur noch ein wenig mit den zahlen in den container des scripts rumwirbeln .... so wie es jetzt ist wird Fenster 1 und Fenster 2 ausgetauscht....

Zählweise von Frames:
Immer von oben links nach unten rechts wie in einer Tabelle
Und nicht vergessen, dass das 1. Frame IMMER die "0" ist!!!!

Verfasst: Fr 25. Okt 2002, 08:50
von jacke
Morgen,

hab rumgewirbelt und mit den Frames passt es jetzt.

Nun hab ich aber noch ein kleines :? Prob mit der übergabe. Mein Link sieht jetzt so aus:

echo "<a href=\"".$con_tree[$nr][link]."\" target=\"main\" onClick=\"moveit('demo_left.php?client=$client&lang=$lang&idcat=$idcat')\"";

irgendwo sind da aber Fehler. Das Prinzip muss aber stimmen, da es funzt wenn ich den Link absolut übergebe:

echo "<a href=\"".$con_tree[$nr][link]."\" target=\"main\" onClick=\"moveit(demo_left.php?client=1&lang=1&idcat=12 )\"";

ich hab mir wohl die falschen Varis rausgesucht?

Jacke

Verfasst: Fr 25. Okt 2002, 11:45
von jacke
Habs endlich!

Hier ein demo_left.php

Beispiel: www.anlagen-planung.de/contenido/front_frame/

wird aber nicht immer funzen, da ich noch am Basteln mit de Knöpche bin. Die sind zu groß, und meine Farben wollen die auch nicht annehmen.
Also jetzt das Frame:





<?php
include("config.php");
include($ContenidoPath."inc/config.php");

page_open(
array("sess" => "Contenido_Session",
"auth" => "Contenido_Frontend_Challenge_Crypt_Auth",
"perm" => "Contenido_Perm"));

include($ContenidoPath.$cfgPathInc."cfg_sql.inc.php");


$db = new DB_Contenido;


?>

<html>

<head>

<script language="JavaScript">
function moveit(place1, place2) {
if (parent.frames[1].location.href != place1) {
parent.frames[1].location.href = place1;
}
if (parent.frames[2].location.href != place2) {
parent.frames[2].location.href = place2;
}
}
</script>


<style>
<!--
a {font-size: 11px; color: black; font-family: Verdana; text-decoration: none}

-->
</style>


</head>
<body BACKGROUND="img_site/bg.gif" bgproperties="FIXED">



<?php
// Gruppen einlesen //

$sql = "SELECT A.idcat, A.parentid, A.preid, A.postid, B.name, B.public, B.visible, C.level FROM $cfgTab_cat AS A, $cfgTab_cat_lang AS B, $cfgTab_cat_tree AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND A.idclient='$client' AND B.idlang='$lang'";
$db->query($sql);
while($db->next_record()){
$con_tree[$db->f("idcat")][parent] = $db->f("parentid");
$con_tree[$db->f("idcat")][preid] = $db->f("preid");
$con_tree[$db->f("idcat")][postid] = $db->f("postid");
$con_tree[$db->f("idcat")][titel] = $db->f("name");
$con_tree[$db->f("idcat")][public] = $db->f("public");
$con_tree[$db->f("idcat")][visible] = $db->f("visible");
$con_tree[$db->f("idcat")][level] = $db->f("level");
$con_tree[$db->f("idcat")][link] = $sess->url("front_content.php?client=".$client."&lang=".$lang."&parent=".$db->f("parentid")."&idcat=".$db->f("idcat")."");
if($db->f("idcat") > $con_tree_max){$con_tree_max = $db->f("idcat");}
};

//-----------------------------------------------------------------------------//
$nav_start = "1"; // Startbaum festlegen
$nav_col_out = "#6699FF"; // Zellfarbe normal
$nav_col_over = "#9999FF"; // Zellfarbe Mouse-Over
$nav_col_back = "#6600FF"; // Hintergrundfarbe (Einzug)
//$nav_col_on = "font13"; // Farbmarkierung aktiv
//$nav_col_off = "font11"; // Farbmarkierung passiv
$nav_col_on = "FF5A00"; // Farbmarkierung aktiv
$nav_col_on_hover = "#3FF200"; // Farbmarkierung aktiv hover
$nav_col_off = "9C9C9C"; // Farbmarkierung passiv
$nav_col_off_hover = "#0005E0"; // Farbmarkierung passiv hover
$nav_button_folder = "img_site/menubuttons/"; // Ort der Buttons
$nav_button_img_ext = ".png"; // Art der Buttons
$bg = "#BEBCF0"; // Hintergrundfarbe Buttons


//-----------------------------------------------------------------------------//


// offenen Pfad finden //
$nav_path = array(); $nav_tree = array();
$tmp_idcat = $idcat;
while($tmp_idcat > 0){
array_push($nav_path, $tmp_idcat);
$tmp_idcat = $con_tree[$tmp_idcat][parent];
};
$nav_path = array_reverse($nav_path);
// gegen Verlassen des Baumes schützen:
if($nav_path[0] != $nav_start){$nav_path = array($nav_start);};
// Baum sortieren //
for($i = 0;$i < sizeof($nav_path);$i++){
$tmp_found=0;
for($nr = 0; $nr <= $con_tree_max; $nr++){
if($con_tree[$nr][parent] == $nav_path[$i] && $con_tree[$nr][preid] == '0'){$tmp_found=1;break;}
}
unset($tmp_level);$tmp_level = array();
do{
array_push($tmp_level , $nr);
$nr = $con_tree[$nr][postid];
} while($nr != '0' && $tmp_found==1);
if($i == 0){$nav_tree = $tmp_level;}
else {
$x = array_search("$nav_path[$i]", $nav_tree);
array_splice($nav_tree, $x+1, 0, $tmp_level);
};
};
// Baum ausgeben //

echo "<table width=\"160\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";

foreach($nav_tree as $nr){

if(($con_tree[$nr][public] == '1' or $auth->auth["uid"] != "nobody") and $con_tree[$nr][visible] == '1'){
unset($mod_space);$mod_space = array();
$mod_space = array_pad($mod_space,($con_tree[$nr][level] - 1),"&nbsp;&nbsp;");
echo "<tr><td valign=\"top\" nowrap>".implode("",$mod_space);


echo "<a href=\"".$con_tree[$nr][link]."\" target=\"main\" onClick=\"moveit('demo_left.php?idcat=$nr')\"";






if($nr == $idcat){
$nav_button_image = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_on.$nav_button_img_ext;
if (!file_exists ($nav_button_image)) {
MakeImage ($bg, $nav_col_on, $con_tree[$nr][titel], $nav_button_image, $nav_button_img_ext);
}
$nav_button_img_hover = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_on_hover.$nav_button_img_ext;
if (!file_exists ($nav_button_img_hover)) {
MakeImage ($bg, $nav_col_on_hover, $con_tree[$nr][titel], $nav_button_img_hover, $nav_button_img_ext);
}
} else {
$nav_button_image = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_off.$nav_button_img_ext;
if (!file_exists ($nav_button_image)) {
MakeImage ($bg, $nav_col_off, $con_tree[$nr][titel], $nav_button_image, $nav_button_img_ext);
}
$nav_button_img_hover = $nav_button_folder.urlencode ($con_tree[$nr][titel]).$nav_col_off_hover.$nav_button_img_ext;
if (!file_exists ($nav_button_img_hover)) {
MakeImage ($bg, $nav_col_off_hover, $con_tree[$nr][titel], $nav_button_img_hover, $nav_button_img_ext);
}

};

echo " onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('".$nav_button_image."','','".$nav_button_img_hover."',1)\"";
echo ">";
echo "<img name=\"".$nav_button_image."\" src=\"".$nav_button_image."\" border=\"0\"alt=\"".$con_tree[$nr][titel]."\"></a>";
echo "</td></tr>\n";

};
};
unset($nav_tree);unset($nav_path);
echo "</table>";

function ConvertColor($hexVal){
$ColorVal = array(3);
for($i = 0; $i < 3; $i++)
$ColorVal[$i] = HexDec(substr($hexVal, $i * 2, 2));
return $ColorVal;
}
function MakeImage($bg, $fg, $txt, $image, $nav_button_img_ext){
$width = 140;
$offset = 20;
$imgFRAME = ImageCreate($width, $offset);

list($red, $green, $blue) = ConvertColor($bg);
$bgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

list($red, $green, $blue) = ConvertColor($fg);
$fgCOLOR = ImageColorAllocate($imgFRAME, $red, $green, $blue);

imagettftext($imgFRAME, 10,0,2,15,$fgCOLOR,"ttf/verdana.ttf",$txt);
if ($nav_button_img_ext == ".png") {
ImagePng($imgFRAME, $image);
}
if ($nav_button_img_ext == ".gif") {
ImageGif($imgFRAME, $image);
}
if ($nav_button_img_ext == ".jpg") {
ImageJPG($imgFRAME, $image);
}
ImageDestroy($imgFRAME);
}
?>


</body>
</html>

Verfasst: Fr 25. Okt 2002, 11:51
von ekke
die 4 Farben sind es:

$nav_col_on = "FF0000"; // Farbmarkierung aktiv (wenn es die Seite ist)
$nav_col_on_hover = "#3FF200"; // Farbmarkierung aktiv hover
$nav_col_off = "000000"; // Farbmarkierung passiv (die anderen Seiten)
$nav_col_off_hover = "#0005E0"; // Farbmarkierung passiv hover

Klasse Jacke.

Gruss ekke

Verfasst: Fr 25. Okt 2002, 11:53
von ekke
und...

Du mußt die Bilder im Ordner img_site/menubuttons/ einmal löschen,
da sind sie gecached, sonst würden sie jedesmal neu generiert, war völlig (CPU) unmöglich.


Gruss ekke

Verfasst: Fr 25. Okt 2002, 11:59
von ekke
und...

die Bilderweite änderst Du unter:

function MakeImage($bg, $fg, $txt, $image, $nav_button_img_ext){
$width = 140;

hier 140 Pixel

die weiteren Einstellungen in
imagettftext($imgFRAME, 10,0,2,15,$fgCOLOR,"ttf/verdana.ttf",$txt);
dafür schaue unter :
http://www.php.net/manual/en/function.imagettftext.php
nach.

Aber keine Angst, ich habe lange gebraucht (wie lange sage ich nicht, sonst blamiere ich mich hier :D )

Gruss ekke

Verfasst: Fr 25. Okt 2002, 12:07
von ekke
man kann natürlich noch mehr mit den Buttons machen, dazu gibt es schon vorgefertige Klassen, habe ich aber zu spät gefunden:

http://www.ulf-wendel.de/php/show_sourc ... e=graphics
http://www.ulf-wendel.de/php/show_source.php?file=gtext
http://www.ulf-wendel.de/php/show_sourc ... le=gbutton

Wer Lust hat, (ich im Augenblick nicht mehr), kann noch Ränder, Schatten, Leuchten etc. machen.

Andere Schrifttypen sind aber überhaupt kein Problem, einfach aus win/fonts einen .ttf nehmen, gehen alle.
im Befehl:
imagettftext($imgFRAME, 10,0,2,15,$fgCOLOR,"ttf/verdana.ttf",$txt);


"ttf/verdana.ttf" ändern in z.B. "ttf/arial.ttf"

Die Schriftgröße ist da:
imagettftext($imgFRAME, 10,0,2,15,$fgCOLOR,"ttf/verdana.ttf",$txt);


10 ist klein, Versuche mal 14 . ungerade Zahlen werden nicht so gut.

Gruss ekke

Verfasst: Fr 25. Okt 2002, 20:29
von jacke
Kann das sein, daß die Knöpche nicht mit Umlauten und Sonderzeichen wie & klarkommen?
Dann ist es natürlich nicht so gut.


Jacke