<?php include('concha.php'); ?>

  <script language=javascript>
function ventanaSecundaria56 (URL){
   window.open(URL,"ventana1","width=960,height=630,scrollbars=NO")
}
  </script>

<nav class="<? if ($estiloweb <= 3){echo "navbar navbar-default navbar-affix-top ";} else {echo "navbar sticky-top navbar-expand-lg navbar-light bg-light";} ?>" data-spy="affix" data-offset-top="<?php echo $alto_logo_nuevo ?>">
    
    <div style="background-color:<?php echo $d_color_fondo_menu ;?>;" class="container-fluid">         
                  <button class="<? if ($estiloweb <= 3){echo "navbar-toggle";} else {echo "navbar-toggler";} ?>" type="button" data-toggle="collapse" data-target="#myNavbar" style="float: left;margin:8px;">
                      
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                      
                    <span class="navbar-toggler-icon"></span>
                  
                    </button>
                
        
                
                <div class="collapse navbar-collapse" id="myNavbar">
                  <ul class="<? if ($estiloweb <= 3){echo "nav navbar-nav";} else {echo "navbar-nav mr-auto";} ?>" style="<? if ($estiloweb <= 3){echo "";} else {echo "margin:0 auto;";} ?>">
                      

  <?php include('concha.php'); ?>  
  <?





$sql = "SELECT * FROM menu WHERE IDsub = '0' ORDER BY ID";

$consulta = $conn->query($sql);
while ($row = $consulta->fetch_assoc())
{
$nombre = $row["nombre"];
$tipo = $row["tipo"];
$link = $row["link"];
$ID_menu = $row["ID"];

  $hay_sub = 'no';
$sql55 = "SELECT * FROM menu WHERE IDsub = '$ID_menu' LIMIT 1";
$consulta55 = $conn->query($sql55);
while ($row55 = $consulta55->fetch_assoc())
{
$hay_sub = 'si';

}
$consulta55->free_result();


?> 
<li class="nav-item" <?php if($hay_sub == 'si') { ?> class="dropdown nav-item" <?php };?>>
    
    <a class="nav-link" <?php if($hay_sub == 'si') { ?> class="nav-link dropdown-toggle" data-toggle="dropdown" <?php };?> href="<?php
    if ($tipo == 'noticias'){  

$sql55 = "SELECT * FROM categorias WHERE ID = '$link'";
$consulta55 = $conn->query($sql55);
while ($row55 = $consulta55->fetch_assoc())
{
$titulo_cat = $row55["nombre"];

}
$consulta55->free_result();

	
	 $titulo_cat = urls_amigables($titulo_cat);
	
	
	 echo "$dom/noticias/$link/$titulo_cat";
	 
	 
	 };

	  if ($tipo == 'seccion'){ 
	  
	  

$sql22 = "SELECT * FROM menu WHERE ID = '$ID_menu'";


$consulta22 = $conn->query($sql22);


while ($row22 = $consulta22->fetch_assoc())


{
$titulo_sec = $row22["nombre"];
 }


$consulta22->free_result();
 $titulo_sec = urls_amigables($titulo_sec);
	  
	  
	    echo "$dom/seccion/$ID_menu/$titulo_sec";};
	    if ($tipo == 'link'){   echo $link;};
    if ($tipo == 'precargado'){  
	
	if ($link == "javascript:ventanaSecundaria56('envivo')") {
	
	$link = "javascript:ventanaSecundaria56('$dom/envivo')";
	 echo "$link";
	 
	 
	 } else { echo "$dom/$link";}; }; 
  ?>" <? if ($tipo == 'link'){ ?> target="_blank" <? }; ?>>
        
        <span style="margin:0 10px;color: <?php echo $d_color_menu ?>;font-family: <?php echo $style_menu ?>;"><?php echo $nombre ?></span> <?php if($hay_sub == 'si') { ?><span class="caret"></span> <?php };?></a>
  
  
  
  <?
  
  
  
  if ($hay_sub == 'si') {
  ?>
   <ul class="dropdown-menu">
  <?
  
  
$sql66 = "SELECT * FROM menu WHERE IDsub = '$ID_menu' ORDER BY ID";

$consulta66 = $conn->query($sql66);
while ($row66 = $consulta66->fetch_assoc())
{
$nombre = $row66["nombre"];
$tipo = $row66["tipo"];
$link = $row66["link"];
$ID_menu = $row66["ID"];

?> 
<li class="nav-item"><a class="nav-link" href="<?php
    if ($tipo == 'noticias'){  

$sql55 = "SELECT * FROM categorias WHERE ID = '$link'";
$consulta55 = $conn->query($sql55);
while ($row55 = $consulta55->fetch_assoc())
{
$titulo_cat = $row55["nombre"];

}
$consulta55->free_result();

	
	 $titulo_cat = urls_amigables($titulo_cat);
	
	
	 echo "$dom/noticias/$link/$titulo_cat";
	 
	 
	 };

	  if ($tipo == 'seccion'){ 
	  
	  

$sql22 = "SELECT * FROM menu WHERE ID = '$ID_menu'";


$consulta22 = $conn->query($sql22);


while ($row22 = $consulta22->fetch_assoc())


{
$titulo_sec = $row22["nombre"];
 }


$consulta22->free_result();
 $titulo_sec = urls_amigables($titulo_sec);
	  
	  
	    echo "$dom/seccion/$ID_menu/$titulo_sec";};
	    if ($tipo == 'link'){   echo $link;};
    if ($tipo == 'precargado'){  
	
	if ($link == "javascript:ventanaSecundaria56('envivo')") {
	
	$link = "javascript:ventanaSecundaria56('$dom/envivo')";
	 echo "$link";
	 
	 
	 } else { echo "$dom/$link";}; }; 
  ?>" <? if ($tipo == 'link'){ ?> target="_blank" <? }; ?>><?php echo $nombre ?></a>
</li>
<?
}
$consulta66->free_result();

?>
 </ul> <?
  
  }

 ?> 
 </li>
<?
}
$consulta->free_result();
?>

                    </ul>
                    
                  </div>
     </div> 
</nav>


