X-Git-Url: https://git.rapsys.eu/blogbundle/blobdiff_plain/3f94f6e7306cf55e23f93090cb34e7c6c2398ba7..654b7d88a927d5ec5aabdaf6adc1594335f61877:/Controller/AbstractController.php?ds=inline diff --git a/Controller/AbstractController.php b/Controller/AbstractController.php index 425cdcc..10353cb 100644 --- a/Controller/AbstractController.php +++ b/Controller/AbstractController.php @@ -55,6 +55,11 @@ abstract class AbstractController extends BaseAbstractController implements Serv */ protected array $config; + /** + * Count integer + */ + protected int $count; + /** * Context array */ @@ -76,7 +81,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv protected \DateTime $modified; /** - * Limit integer + * Page integer */ protected int $page; @@ -456,6 +461,21 @@ abstract class AbstractController extends BaseAbstractController implements Serv } } + //With count + if (!empty($this->count)) { + //With prev link + if ($this->page > 0) { + //Set head prev + $parameters['head']['prev'] = $this->generateUrl($this->request->get('_route'), ['page' => $this->page - 1]+$this->request->get('_route_params')); + } + + //With next link + if ($this->count > ($this->page + 1) * $this->limit) { + //Set head next + $parameters['head']['next'] = $this->generateUrl($this->request->get('_route'), ['page' => $this->page + 1]+$this->request->get('_route_params')); + } + } + //Without facebook image defined and texts if (empty($parameters['head']['facebook']['og:image']) && !empty($this->request) && !empty($parameters['head']['fbimage']['texts']) && !empty($this->modified)) { //Get facebook image