phpbar.de logo

Mailinglisten-Archive

[php] Leerer return string

[php] Leerer return string

Alexander Rabenstein a.rabenstein at eviga.de
Fre Nov 21 12:14:20 CET 2003


Hallo Liste,

Ich sehe mal wieder den Wald vor lauter Bäumen nicht, 
kann mir vielleicht von euch jemand verraten wieso das hier nicht funzt so
wie es soll:

   <?php
     include ("config.inc");
	 class top_link {
	   var $name;
	   var $href;
	   var $subs;
	   function top_link($name,$href) {
	   			$this->name=$name;
				$this->href=$href;
				
	   }
	   function new_sub ($name,$href) {
	      $this->subs[]=new sub_link($name,$href);
	   }
	   function echo_links(){
		  
		  $html="<td class=\"menu\" width=\"200\" height=\"55\"><a
class=\"menu1\" href=\"nav.php?action=0\"
target=\"nav\">News</a></td>";
		  foreach ($this->subs as $value){
		    $html+=$value->echo_links();
		  }
		  return $html;
		 } 
	 }
	 class sub_link {
	     var $name;
		 var $href;
		 
		 function sub_link($name,$href){
		        $this->name=$name;
				$this->href=$href;
		 }
		 function echo_links(){
		  $html="<tr><td><a class =\"menu2\"
href=\"".$this->href."\" target=\"content\">".$this->name."</a></td></tr>";
		  return $html;
		 }
	 }
	 class links {
	     var $mylinks;
		 function links (){
		   $result=mysql_query("select * from sys_links where
sprache = '".$_GET["lang"]."' and typ='top'");   
           while($row=mysql_fetch_array($result)){
   		     $this->mylinks[$row["id"]]=new
top_link($row["name"],$row["href"]);
           }
		   
		   $result=mysql_query("select * from sys_links where
sprache = '".$_GET["lang"]."' and typ='sub'");   
           while($row=mysql_fetch_array($result)){
   		     $this->mylinks[$row["parent"]]->subs[$row["id"]]=new
sub_link($row["name"],$row["href"]);
           }
		 }
		 
		 function echo_links(){
		  $html="";
		  foreach ($this->mylinks as $value){
		   
		   $html+=$value->echo_links();
		  }
		  var_dump($html);
		  return $html;
		 }
	 }
	 $evigalinks= new links();
	 //var_dump($evigalinks);
	 
	 $evigalinks->echo_links();
   ?>


php::bar PHP Wiki   -   Listenarchive