Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/08/2009, 11:19
delfin85
 
Fecha de Ingreso: julio-2008
Mensajes: 59
Antigüedad: 18 años, 2 meses
Puntos: 1
Exclamación include en php no se muestran

hola chicos muy buenas tardestengo un problema les explico:

tengo dos menus uno en forma de arbol q aparece en la parte iz y un menu superior

el problema es q esos dos archivos los quiero incluir en uno solo. pero al visualizar la pagina solo me muestra uno. les dejo mi codigo a ver si me pueden ayudar.

menus.php
Código PHP:
<?php 
require_once('menu.php'); 
require_once(
'arbol.php');

?>

arbol.php
Código PHP:
<?php
error_reporting
(0);

include(
'TreeMenu.php');
include(
"globals.php");

//Declaracion de variables
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
$arr_MenuArbol=array(); 

//Se manda llamar la consulta del MenuArbol 
Consulta_MenuArbol($arr_MenuArbol);


$menu = new HTML_TreeMenu();    

foreach( 
$arr_MenuArbol as $Element ) {    
    
    ${
trim($Element["NodoID"])} = new HTML_TreeNode(
        array(
            
'text'=>trim($Element["Texto"]),
            
'link'=>trim($Element["link"]), 
            
'icon' => $icon, 
            
'expandedIcon' => $expandedIcon
        
)
    );
    switch (
trim($Element["Orden"])){ 
        case 
0:
            
$menu->addItem(${trim($Element["NodoID"])}); 
            break ;
        case 
1: 
            ${
substr(trim($Element["NodoID"]),0,strlen(trim($Element["NodoID"]))-2)}->addItem(${trim($Element["NodoID"])});                        
            break ;
    }
            
}

//Crear la presentación del árbol
$treeMenu = new HTML_TreeMenu_DHTML($menu, array('images' => 'imagesAlt2', 'defaultClass' => 'treeMenuDefault'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="TreeMenu.js" language="JavaScript" type="text/javascript"></script>
<link href="css/css_arbol.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="arbol">
    <?php $treeMenu->printMenu()?>
</div>
<div class="logo"><img src="images/NuevoLaredo.png" width="200" height="80"></div>
</body>
</html>

menu.php
Código PHP:
<?php


     
include("globals.php");
     
$type   = $_REQUEST["type"];
     
$valor  = $_REQUEST["valor"];
     
$id     = $_REQUEST["id"];
     
$campoOrden = $_REQUEST["campoOrden"];
     
$arr_usuarios=array();  
     
$row_rstCiudadanos=array();  //Declara un Arreglo
      
$arr_Menu=array();  
      
Consulta_Menu( $id,  $arr_Menu);

?>

<?php
    error_reporting 
( E_ALL );
    
        
$xxx= count($arr_Menu);
                      
        
$Arreglo = '$menu = array(';
        foreach( 
$arr_Menu as $Element ) {    
        
            
        
$Arreglo.= trim(($Element["idMenu"])) .'=> array';
        
$Arreglo.="(";
        
$Arreglo.='\'text\'                       => trim(\''.$Element["text"].'\'),';
        
$Arreglo.='\'class\'                     => trim(\''.$Element["class"].'\'),';
        
$Arreglo.='\'link\'                         => trim(\''.$Element["link"].'\'),';
        
$Arreglo.='\'show_condition\'             =>    '.$Element["show"].',';
        
$Arreglo.='\'parent\'                     =>    trim(\''.$Element["parent"].'\'),';
        
$Arreglo.="),";        
    
        }
        
$Arreglo.=");";

eval((
$Arreglo));


    function 
build_menu ( $menu )
    
    {
        
$out  = '<div class="container4">' . "\n";
        
$out .= '    <div class="menu4">' . "\n";
        
$out .= "\n".'<ul>' . "\n";

        for ( 
$i = 1; $i <= count ( $menu ); $i++ )
        {

            if ( 
is_array ( $menu [ $i ] ) ) {//must be by construction but let's keep the errors home

                
if ( $menu [ $i ] [ 'show_condition' ] && $menu [ $i ] [ 'parent' ] == 0 ) {//are we allowed to see this menu?
                    
$out .= '<li class="' . $menu [ $i ] [ 'class' ] . '"><a href="' . $menu [ $i ] [ 'link' ] . '">';
                    
$out .= $menu [ $i ] [ 'text' ];
                    
$out .= '</a>';
                    
$out .= get_childs ( $menu, $i );
                    
$out .= '</li>' . "\n";
        
                }
            }
            else {
                die ( 
sprintf ( 'menu nr %s must be an array', $i ) );
            }
        }
        
        
$out .= '</ul>'."\n";
        
$out .= "\n\t" . '</div>';
        return 
$out . "\n\t" . '</div>';
    }
    
    function 
get_childs ( $menu, $el_id )

    {
        
$has_subcats = FALSE;
        
$out = '';
        
$out .= "\n".'    <ul>' . "\n";
        for ( 
$i = 1; $i <= count ( $menu ); $i++ )

        {
            if ( 
$menu [ $i ] [ 'show_condition' ] && $menu [ $i ] [ 'parent' ] == $el_id ) {//are we allowed to see this menu?

                
$has_subcats = TRUE;
                
$add_class = ( get_childs ( $menu, $i ) != FALSE ) ? ' subsubl' : '';
                
$out .= '        <li class="' . $menu [ $i ] [ 'class' ] . $add_class . '"><a href="' . $menu [ $i ] [ 'link' ] . '">';
                
$out .= $menu [ $i ] [ 'text' ];
                
$out .= '</a>';
                
$out .= get_childs ( $menu, $i );
                
$out .= '</li>' . "\n";
            }
        }
        
$out .= '    </ul>'."\n";
        return ( 
$has_subcats ) ? $out : FALSE;
    }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div style="width:auto; margin:0px auto; autoz-index:10"> 
<?php echo build_menu ( $menu ); ?>
</div>
</body>
</html>

cuando los visualizo cada uno por su parte si se muestran

cuando los incluyo en menus.php solo me muestara unoel q incluya primero.
a que se debe¡??¡?¡?¡?¡?¡?