<?
$Y = $a;
$D = $d;

include 'marco1desx.php';



include 'concha.php';



$sql = "SELECT ID,titulo,texto,bajada,audio,youtube,d,m,a,carpetafoto,foto,cat,home,impresiones, ext_img FROM notas WHERE destacado = 'no' AND ver = 'si' ORDER BY ID desc LIMIT $cantidad_notas";

$consulta = $conn->query($sql);

while ($row = $consulta->fetch_assoc())

{

$ID = $row["ID"];

$i_publi = $i_publi + 1;

$titulo = $row["titulo"];

$bajada = $row["bajada"];

$texto = $row["texto"];

$audio = $row["audio"];

$youtube  = $row["youtube"];

$d = $row["d"];

$m = $row["m"];

$a = $row["a"];

$fecha = "$d - $m - $a";

$carpetafoto = $row["carpetafoto"];

$foto = $row["foto"]; $ext_img = $row["ext_img"];

$cat = $row["cat"];

$home = $row["home"];

$impresiones = $row["impresiones"];

$impresiones = $impresiones + 1;

$sSQL="UPDATE  `$basedatos`.`notas` SET  `impresiones` =  '$impresiones' WHERE ID = '$ID'";

$conn->query($sSQL);



$M = $m;



if ($M == '01') {$m = "enero";};



if ($M == '02') {$m = "febrero";};



if ($M == '03') {$m = "marzo";};



if ($M == '04') {$m = "abril";};



if ($M == '05') {$m = "mayo";};



if ($M == '06') {$m = "junio";};



if ($M == '07') {$m = "julio";};



if ($M == '08') {$m = "agosto";};



if ($M == '09') {$m = "septiembre";};



if ($M == '10') {$m = "octubre";};



if ($M == '11') {$m = "noviembre";};



if ($M == '12') {$m = "diciembre";};







if ($cat == 0) {} else {

$sql2 = "SELECT * FROM categorias WHERE ID = '$cat'";

$consulta2 = $conn->query($sql2);

while ($row2 = $consulta2->fetch_assoc())

{

$cat = $row2["nombre"];

$color_cat = $row2["color"];

}

$consulta2->free_result();

}

?>

<?

$n = 0;

$sql2 = "SELECT * FROM comentarios WHERE IDD = '$ID' and ver = 'si'";

$consulta2 = $conn->query($sql2);

while ($row2 = $consulta2->fetch_assoc())

{

$n = $n + 1;

}

$consulta2->free_result();

?>

<? $marco1px1 = "$marco1px"; ?>

<? $marco1px = "100%"; ?>

<div class="grid-item col-xs-12 col-sm-6 col-md-6 col-lg-6">







    

<?php if ($home == 'no') {} else {?>

<?php if ($cat == '0') {} else {?>

    

    

        <div style="margin:3px 0;"  class="">

            <span style="letter-spacing:0.5px;line-height:1em;padding:2px 7px;background-color:<?php if ($color_cat == '' or $color_cat == '#FFFFFF') { echo "#666666"; } else { echo $color_cat; }; ?>;font-family:<?php echo $style_titulo ?>;font-size:11px; color:#FFFFFF;"><?php echo $cat ?></span>

        </div>

    



<?php };?>

    

    <style>.tita:hover span{}</style>

    

        <div style="margin:3px 0;padding: 5px;">

            <a style="color: #fff;" href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>" class="tita">

                <span style="line-height:<?php echo $d_ta_titulo?>;display:block;font-family:<?php echo $style_titulo ?>;font-size:<?php echo $d_ta_titulo?>;color:<?php echo $d_color_titulo?>;"><?php echo $titulo ?></span>

            </a>

        </div>

    

<?php  if ($foto == NULL) { } else { ?>

    

<div>



<?php $dom1  = $dom; ?>

<?php 



  $file = "$dom1/$carpetafoto/thumbnail_$foto$ext_img";  // Dirección de la imagen

 

  $imagen = getimagesize($file);    //Sacamos la información

  $ancho = $imagen[0];              //Ancho

  $alto = $imagen[1];               //Alto

 



 $alto_m = $alto * 1.05;

  $ancho_m = $ancho * 1.05;

 

 if ($estiloweb == 1) { $alto_new = $alto * 322 / $ancho; } else 

 { $alto_new = $alto * 410 / $ancho; };

  

   

   

  $alto_new = round($alto_new);

  

  

?>

<style>

 



.img-contenedor {/*Ancho y altura son modificables al requerimiento de cada uno*/

    width:<?php echo $marco1px ?>;

    /*height:<?php echo $alto_new ?>px;*/

    overflow:hidden;

}

 </style>



<div class="img-contenedor img-responsive" style="">

<?php if ($funcion2 == 'si') { ?>

<div class="fecha_cuadrada" style="background-color:<?php echo $d_color_fondo_menu ?>"><a href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>">

<span style="font-family:<?php echo $style_titulo ?>;font-size:20px; color:#FFFFFF;"><?php echo $d ?></span><br />

<span style="font-family:<?php echo $style_titulo ?>;font-size:12px; color:#FFFFFF;"><?php echo $m ?></span></a>

</div> <?php };?>





<a style="display:block;" href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>"><img src="<?php echo $dom ?>/<?php echo $carpetafoto ?>/thumbnail_<?php echo $foto ?><?php echo $ext_img ?>" alt="<?php echo $titulo ?>" width="<? echo $marco1px ?>"  border="0" /></a>





</div>

<?php 



$sql65 = "SELECT ID FROM fotos_notas WHERE noticia = '$ID' LIMIT 1";

$consulta65 = $conn->query($sql65);

while ($row65 = $consulta65->fetch_assoc())

{



?>

<div align="right"><a href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>"><img src="<?php echo $dom ?>/fotogaleria.png" width="140" /></a></div>

<?





 }

$consulta65->free_result();



?>







</div>

    

<?php  }; ?>





<?php 

///////youtube ?>

<?php  if ($youtube == NULL) { } else { ?>

 <div style="display:block;margin-top:10px;">  



<iframe width="<? echo $marco1px ?>" height="315" src="https://www.youtube.com/embed/<?php echo $youtube ?>" frameborder="0" allowfullscreen></iframe>

     

</div>

    

<?php  }; ?>

    

<div style="display:block;">



    <div align="justify" style="margin-top:10px;">

        <span style=" font-family:<?php echo $d_fu_texto ?>; font-size:<?php echo $d_ta_texto ?>;color:#6B6B6B; line-height:<?php echo $d_ta_texto ?>;"><?php echo $bajada ?></span>

    </div>

    

<?php include 'audio.php'; ?>

    

</div>

    

<div style="display:block;position:relative;right:0;margin:3px 0;">



    <div align="right" style="">

        

<?php if ($n == 0) { ?>

            <a style="color:#6B6B6B;" href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>">Dejar un comentario<? if ($texto == '') {} else {?> - Leer m&aacute;s...<? }; ?></a> 

            <?php } else {?>

            <a style="color:#6B6B6B;" href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>"> <?php echo $n ?> comentarios<? if ($texto == '') {} else {?> - Leer m&aacute;s...<? }; ?></a>

<?php };?>

        

    



    <?php include 'compartir_nota_facebook.php';?>

        

    </div>

</div>



<div style="margin:3px 0;width:100%;height:3px;border-top:0.5px solid rgba(0,0,0,0.1)!important;">



</div>



<?php };?>









<?php 

$sql2 = "SELECT * FROM publicidades WHERE lugar = '$i_publi'";

$consulta2 = $conn->query($sql2);

while ($row2 = $consulta2->fetch_assoc())

{

$img = $row2["img"];

$url = $row2["url"];



$carpetafoto = $row2["carpetafoto"];



?>





<div style="text-align:center;">

<?php   if ($url == NULL) {} else { ?>

    <a href="<?php echo $url ?>"  target="_blank" class="Estilo1"><?php };?><img class="lazy img-responsive" src="<?php echo $carpetafoto?>/resize_<?php echo $img ?>.jpg" class="img-responsive" width="100%"> <?php   if ($url == NULL) {} else { ?> </a><?php };?>

  </div>





<div style="margin:3px 0;width:100%;height:3px;border-top:0.5px solid rgba(0,0,0,0.1)!important;">



</div>



<?

}

$consulta2->free_result();

?>







<?php

////////////GIF

$sql2 = "SELECT * FROM publicidades_gif WHERE lugar = '$i_publi'";

$consulta2 = $conn->query($sql2);

while ($row2 = $consulta2->fetch_assoc())

{

$img = $row2["img"];

$url = $row2["url"];



$carpetafoto = $row2["carpetafoto"];



?>





<div style="text-align:center;">

<?php   if ($url == NULL) {} else { ?>

    <a href="<?php echo $url ?>"  target="_blank" class="Estilo1"><?php };?>

        <img class="lazy" src="<?php echo $dom ?>/<?php echo $carpetafoto?>/<?php echo $img ?>" width="100%" alt="PUBLICIDAD"   border="0" /><?php   if ($url == NULL) {} else { ?> </a><?php };?>

  </div>





<div style="text-align:center;">

    <img src="linea.gif" align="middle"  class="img-responsive" />

    </div>



<?

}

$consulta2->free_result();

//////////////////// FIN GIF

?>







<?php

////////////SLIDE

$sql2 = "SELECT ID FROM publicidades_slide WHERE lugar = '$i_publi'";

$consulta2 = $conn->query($sql2);

while ($row2 = $consulta2->fetch_assoc())

{

$ID_p = $row2["ID"];



$width_slide = "$marco1px";  include 'publicidad_slider_virgen.php';



}

$consulta2->free_result();

//////////////////// FIN SLIDE

?>









<?php     $tam_ancho = 300;

$sql44 = "SELECT * FROM publicidades_swf WHERE lugar = $i_publi";

$consulta44 = $conn->query($sql44);

while ($row44 = $consulta44->fetch_assoc())

{

$ID = $row44["ID"];

$swf = $row44["swf"];

$carpetafoto = $row44["carpetafoto"];

$ancho = $row44["ancho"];

$alto = $row44["alto"];

$lugar = $row44["lugar"];

$tam_alto = $alto * $tam_ancho / $ancho;

?>



<div style="text-align:center;">

<object  width="<?php echo $tam_ancho ?>" height="<?php echo $tam_alto ?>">

<param name="src" value="<? echo $dom ?>/<? echo $carpetafoto ?>/<?php echo $swf ?>" />

<embed src="<? echo $dom ?>/<? echo $carpetafoto ?>/<?php echo $swf ?>" pluginspage="https://www.adobe.com/shockwave/download/" width="<?php echo $tam_ancho ?>" height="<?php echo $tam_alto ?>"><embed>

</object>

  </div>









<div style="text-align:center;">

    <img src="linea.gif" align="middle"  class="img-responsive" />

    </div>



<?

}

$consulta44->free_result();

?>






</div>



             <?   if(($i_publi % 5 ) == 0){ ?>
             
                <?       if ($adsense == ' ') {} else { ?>
                <div class="grid-item col-xs-12 col-sm-6 col-md-6 col-lg-6" style="text-align:center; ">
     <?php echo    $adsense ?>
        
           </div>          
         <?  }; ?>  
  <?  }; ?>  


<?php 



$i= $i + 1;



}

$consulta->free_result();

?>



