<?

include('concha.php');



$sql = "SELECT * FROM `modulos_con_noticias`";
$consulta = $conn->query($sql);

while ($row = $consulta->fetch_assoc()){
    
        $ID = $row["ID"];
        $titulo = $row["titulo"];
        $cont = $cont + 1;
        
        $sql11 = "SELECT * FROM `notas`";
        $consulta11 = $conn->query($sql11);
        while ($row11 = $consulta11->fetch_assoc()){
            
            $destacado_modulo = $row11["destacado"]; 
            $detacado_mod = $row11["detaca_modulo"]; 
        
            if ($destacado_modulo == '3' && $cont == $detacado_mod) {
            // echo $destacado_modulo;
            // echo $detacado_mod;
            ?>
            
                <article style="margin-bottom:1em;">
                    
                  <div class="base-box2">
                      
                       <div class="widget-head">
                              
                              <h3 class="widget-title"><span><? echo $titulo ?></span></h3>
                
                       </div>
                          
                            <div class="p-0 mt-3 col-12">
                
                                <div class="flickity-carousel carousel js-flickity flickity-enabled is-draggable" data-flickity='{ "lazyLoad": 1, "initialIndex": 0, "autoPlay": 7500, "freeScroll": false, "wrapAround": true, "pageDots": false  }'>
                
                              
                                <?
                
                                   
                                    $sql22 = "SELECT * FROM `notas` WHERE `notas`.`detaca_modulo` = '$ID' && `destacado` = '3'";
                
                                    $consulta22 = $conn->query($sql22);
                                    while ($row22 = $consulta22->fetch_assoc())
                                    {
                                   
                                        $ID_modulo = $row22["ID"];
                                        
                                        $titulo_modulo = $row22["titulo"];
                                        $bajada = $row22["bajada"];
                                        $texto = $row22["texto"];
                                        $audio = $row22["audio"];
                                        $youtube  = $row22["youtube"];
                                        $d = $row22["d"];
                                        $m = $row22["m"];
                                        $a = $row22["a"];
                                        $fecha = "$d - $m - $a";
                                        $carpetafoto = $row22["carpetafoto"];
                                        $foto = $row22["foto"];
                                        $ext_img = $row22["ext_img"];
                                        $cat = $row22["cat"];
                                    ?>
                                        
                                        <div class="carousel-cell col-12">
                
                
                                                <div class="wow fadeIn" data-wow-duration="1s">
                                                    <article class="wow fadeIn" data-wow-duration="1s">
                
                                                        <?
                                                            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();
                                                            }
                                                        ?>
                
                                                        <div class="news-image" style="">
                
                
                                                        <a class="tshare facebook" style="background-color: <?php echo $color_cat ?>!important;color:rgba(<? echo $color_titulo_barra2 ?>)!important;" href="javascript:ventanaSecundaria56('https://www.facebook.com/sharer.php?p[title]=<?php echo $titulo1 ?>&p[url]=<?php echo $dom ?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>')"><i class="fab fa-facebook" aria-hidden="true"></i></a>
                
                                                        <a class="tshare twitter" style="background-color: <?php echo $color_cat ?>!important;color:rgba(<? echo $color_titulo_barra2 ?>)!important;" href="javascript:ventanaSecundaria56('https://twitter.com/share?original_referer=<?php echo $dom ?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>&amp;source=tweetbutton&amp;text=<?php echo $titulo; ?> - Leer: &amp;url=<?php echo $dom ?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>')"><i class="fab fa-twitter" aria-hidden="true"></i></a>
                
                
                
                                                        
                                                        <a href="<? echo $dom;?>/nota/<?php echo $ID_modulo ?>/<?php echo urls_amigables($titulo_modulo) ?>" style="text-align:center;">
                                                            <img class="img-fluid" src="<?php echo $dom ?>/<?php echo $carpetafoto ?>/thumbnail_<?php echo $foto ?><?php echo $ext_img ?>" data-hidpi="<?php echo $dom ?>/<?php echo $carpetafoto ?>/thumbnail_<?php echo $foto ?><?php echo $ext_img ?>" alt="<?php echo $titulo ?>">
                                                        </a> 
                
                                                        </div>
                                                        <div class="news-summary">
                                                        <a href="<? echo $dom;?>/nota/<?php echo $ID_modulo ?>/<?php echo urls_amigables($titulo_modulo) ?>"><h3 class="colorTitulo"><?php echo $titulo_modulo ?></h3></a>
                                                        <div class="mom-post-meta nb-item-meta">
                                                            <span class="entry-date"><?php echo $d ?> de <?php echo $m ?>, <?php echo $a ?></span>
                                                        </div>
                                                            <div class="bajada d-none">
                                                                <p class="selectionShareable" style="margin-bottom:0;"><?php $bajada = str_replace('<em>','',$bajada);  $bajada = str_replace('</em>','',$bajada);  echo $bajada; ?></p>
                                                            </div>
                                                        </div>
                
                
                                                    </article>
                                            
                                                </div>
                
                                            </div>
                
                                       
                
                                    <?
                
                                    }
                
                                    $consulta22->free_result();
                
                                    ?>
                      
                
                                </div>        
                            </div>
                          
                  </div>
                    
                </article>
            
            <? } else {}
        
        }$consulta11->free_result();
    
    } $consulta->free_result();

?>