Beispiel #1
0
    case "C/Cpp":
        $Categoria = "C y C++";
        break;
    case "C-C  ":
        $Categoria = "C y C++";
        break;
    case "C-y-C  ":
        $Categoria = "C y C++";
        break;
    case "C%20y%20C++":
        $Categoria = "C y C++";
        break;
    case "Tutoriales":
        $Categoria = "Todo";
        break;
}
$Categoria = str_replace("-", " ", $Categoria);
include "Web/GenerarIndice.php";
$Base = new devildrey33();
/* Regenerar el indice sin cargar nada mas */
if (isset($_GET["Regenerar"])) {
    echo Indice::GenerarIndice($Base->BD, $Categoria);
    exit;
}
$Base->InicioPlantilla(basename(__FILE__), "devildrey33", "");
$Base->BD = new devildrey33_BD();
echo Indice::GenerarIndice($Base->BD, $Categoria, 0);
if (isset($_GET["Loguear"])) {
    echo "<script>" . "\$('#VentanaLogin').attr({ 'Visible' : 'true' });" . "setTimeout(function() { \$('#devildrey33_Usuario').focus(); }, 200);" . "</script>";
}
$Base->FinPlantilla();
 public function IndiceObtener15Mas()
 {
     $BD = new devildrey33_BD();
     echo json_encode(["HTML" => Indice::GenerarArticulos($BD, $_POST["Categoria"], $_POST["Inicio"]), "ErroresPHP" => Base::ObtenerLogPHP(), "Estado" => 0]);
 }
 static function GenerarArticulos($BD, $Categoria = "Todo", $Inicio = 0, $Fin = 16)
 {
     /* Si inicio es 0 hay que comprobar que no se hubieran cargado elementos anteriormente mediante el scroll */
     /*            if ($Inicio === 0) {
                     $Inicio = devildrey33_Opciones::EntradasIndice();
                 }*/
     $Entradas = (require dirname(__FILE__) . '/Config/EntradasBlog.php');
     if ($Categoria === "Todo") {
         $EntradasPC = $Entradas;
     } else {
         /* Creo un array solo con las entradas que tengan la categoria especificada */
         for ($i = 0; $i < count($Entradas); $i++) {
             if (Indice::BuscarCategoria($Entradas[$i]["Tags"], $Categoria) === TRUE) {
                 $EntradasPC[] = $Entradas[$i];
             }
         }
     }
     $Codigo = "";
     if ($Categoria == "") {
         $Categoria = "Todo";
     }
     $Contador = 0;
     for ($i = $Inicio; $i < count($EntradasPC); $i++) {
         //                if (Indice::BuscarCategoria($Entradas[$i]["Tags"], $Categoria) === TRUE) {
         switch ($EntradasPC[$i]["Tipo"]) {
             case "Blog":
             default:
                 $URL = Base::URL_Blog() . $EntradasPC[$i]["URL"];
                 $EntradasPC[$i]["URL"] .= ".php";
                 break;
             case "Lab":
                 $URL = Base::URL_Lab() . $EntradasPC[$i]["URL"];
                 break;
         }
         // Parche parche para que como mínimo en un servidor local no dedicado (localhost/directorio-web) se pueda acceder a las entradas del indice
         //                    if ($EntradasPC[$i]["Tipo"] === "Blog" && devildrey33_Opciones::$ServidorLocal === TRUE) { $URL .= ".php"; }
         $Codigo .= "<article class='Articulo_Portada' style='transition-delay:" . rand(0, 50) / 100 . "s'>" . Intro();
         $Codigo .= "<a href='" . $URL . "'>" . Intro() . "<div class='Articulo_Portada_ImagenO'></div>" . Intro() . "<img src='" . Base::URL_Graficos() . "155x125_" . $EntradasPC[$i]["Imagen"] . "' class='Articulo_Portada_Imagen' alt='" . $EntradasPC[$i]["Titulo"] . "' />" . Intro() . "</a>" . Intro();
         $Codigo .= "<h1><a href='" . $URL . "'>" . $EntradasPC[$i]["Titulo"] . "</a></h1>" . Intro();
         $Codigo .= "<span>" . substr($EntradasPC[$i]["Fecha"], 0, 2) . " de " . Indice::ObtenerMesStr(substr($EntradasPC[$i]["Fecha"], 3, 2)) . " del " . substr($EntradasPC[$i]["Fecha"], 6, 4) . " por <b>" . $EntradasPC[$i]["Autor"] . "</b>" . Intro();
         $Codigo .= $BD->ObtenerValoresEntrada($EntradasPC[$i]["URL"], $EntradasPC[$i]["Titulo"], false) . Intro();
         //                echo    ", 894 visitas, 0 comentarios, 0 votos.</span><br />";
         $Codigo .= "<span><br />" . Intro();
         $Codigo .= Indice::EnlazarTags($EntradasPC[$i]["Tags"]) . Intro();
         $Codigo .= "</span>" . Intro();
         $Codigo .= "</span>" . Intro();
         $Codigo .= "</article>" . Intro();
         // Ultimo articulo de la lista
         $Contador++;
         if ($i === count($EntradasPC) - 1) {
             $Codigo .= "<div finscrollinfinito='true'></div>" . Intro();
         }
         //                }
         // Cuando se leen 16 articulos paramos
         if ($Fin === $Contador) {
             devildrey33_Opciones::EntradasIndice($Inicio + $Contador);
             /* Guardo en la sesión el número de entradas guardadas con el scroll en el indice */
             return $Codigo;
             /* - De esta forma si se vuelve al indice por el historial volverá a la posición de la entrada a la que se accedió */
         }
     }
     return $Codigo;
 }