<?php include("conteudo/ninc/topo.php"); ?>
<?php include("conteudo/ninc/topo-br.php"); ?>





 <div class="container space main">  
    <div class="row">

      <div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 main">
        <section class="base text">

        <h2><i class="fa fa-chevron-right"></i> Dicas</h2>

        <?php

        $arr = explode('/', $uquerys); 


        $sql_total = mysql_query("SELECT id FROM noticias");
        $num = mysql_num_rows($sql_total);


        $n  = 5; //n por página

        $paginas = ceil($num/$n);
        if(is_array($arr))
        {
          if(isset($arr['1']))
          { 
           $p = $arr['1'];

      
          }

        }
        if(!isset($p)){

  
          $p = 1; 
    
        }else{

          if( $p>$paginas  || $p=='') { 
          $p = 1; 
          }    
        }

    

        $ini = ($n * $p) - $n;

        $sql = mysql_query("SELECT * FROM noticias ORDER BY data_cad DESC limit $ini,$n");
  

        while($not = mysql_fetch_assoc($sql)){  






        ?>


        <div class="boxn">
          <h3><a class="animate" href="<?php echo sti("urlbase") ?>dica/<?php echo $not['slug'];  ?>"><?php echo $not['titulo_pt'];  ?></a></h3>
          
          <img class="img-responsive" src="<?php echo sti("urlbase");  ?>assets/uploads/noticias/<?php echo $not['imagem'];  ?>" width="100%" height="100%" alt="<?php echo $not['titulo_pt'];  ?>"/>


          <p><?php echo corta(strip_tags(html_entity_decode($not['texto_pt'])), 350); ?></p>
          <p class="mais"><a class="animate" href="<?php echo sti("urlbase") ?>dica/<?php echo $not['slug'];  ?>">Leia mais</a></p>
        </div>



          <hr/>

     
        <?php  } ?>
        <br/><br/>

        <div class="pag">
        <ul class="tooltip">
        <?php           
        $menos = $p - 1;

        $mais = $p + 1;
        $pgs = $paginas;
        if($p != 1){echo "<li><a href=\"".sti('urlbase').'dicas/'."\">Primeira</a></li>";}
        if($pgs > 1 )
        {

        if($menos > 0)
        echo "<li><a href=\"".sti('urlbase').'dicas/'.$menos."\" >Anterior</a></li> "; 
        if (($p-2) < 1 )   
        $anterior = 1;  
        else $anterior = $p-2;
        if (($p+2) > $pgs )
        $posterior = $pgs;
        else  
        $posterior = $p + 2; 
        for($j=$anterior;$j <= $posterior; $j++)
        if($j != $p)     
        echo " <li><a  title=\"Página ".$j."\" href=\"".sti('urlbase').'dicas/'.$j."\" >$j</a></li>";
        else
        echo " <li class=\"active\"><span class=\"active\">".$j."</span></li>";
        if($mais <= $pgs)
        echo "<li> <a href=\"".sti('urlbase').'dicas/'.$mais."\" >Próxima</a></li>";
        }
        if($mais!=$pgs+1&&$pgs>1){echo "<li><a href=\"".sti('urlbase').'/dicas/'.$pgs."\">Última</a></li>";}
        ?>
        </ul>

   </div>


   		</section>
      </div>



      <div class="col-xs-12 col-sm-3 col-sm-offset-1 col-md-3 col-md-offset-1 col-lg-3 col-lg-offset-1 side main">

            <h2>Leia também</h2>


            <?php              $sel_noti = mysql_query("SELECT * FROM noticias  ORDER BY rand() LIMIT 4"); 



              while($not = mysql_fetch_assoc($sel_noti)){
             ?>


            <div class="dicas">
                  <div class="box animate">
                    <a href="<?php echo sti("urlbase") ?>dica/<?php echo $not['slug'];  ?>"><img class="img-responsive" src="<?php echo sti("urlbase");  ?>assets/uploads/noticias/<?php echo $not['imagem'];  ?>" width="100%" height="100%" alt="<?php echo $not['titulo_pt'];  ?>"/></a>
                    <h4><a href="<?php echo sti("urlbase") ?>dica/<?php echo $not['slug'];  ?>"><?php echo $not['titulo_pt'];  ?></a></h4>
                  </div>
  
            </div>        
        <?php  }  ?>
      </div>


    </div>
  </div>



<?php // include("conteudo/ninc/depoimentos.php"); ?>





  <div><!-- fechamento desta div no rodapé -->

  <footer style="display:none;">
    <div class="container">  
       <div class="row">

            <?php include("conteudo/ninc/rodape-cidades.php"); ?>
          <?php include("conteudo/ninc/rodape.php"); ?>