<?php
namespace App\Controller;
use App\Utils\BlogService;
use ReCaptcha\ReCaptcha;
use ReCaptcha\RequestMethod\CurlPost;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class BlogController extends AbstractController
{
private $blogService;
public function __construct(BlogService $blogService)
{
$this->blogService = $blogService;
}
public function index($page)
{
//Metaetiquetas para la pagina principal
$url = 'listadoblog';
//seo on page
$seo_on_page = $this->blogService->DevolverSeoOnPage($url);
// listar
$anuncios = $this->blogService->ListarBlogs($page);
return $this->render('frontend/blog/index.html.twig', array(
'seo_on_page' => $seo_on_page,
'anuncios' => $anuncios,
'ruta' => 'listadoblog',
'parametro_ruta' => null,
));
}
public function detalle($url)
{
$anuncio = $this->blogService->DetalleBlog($url);
if (!empty($anuncio)) {
return $this->render('frontend/blog/detalle.html.twig', array(
'anuncio' => $anuncio
));
} else {
return $this->redirectToRoute('error404');
}
}
}