I would like to redirect from page index to slide 1 to slide 2 and then to slide 3 every 5 seconds. How can I do that. So far i try this using this documentation: http://symfony.com/doc/3.1/components/http_foundation.html#redirecting-the-user
and help from this question:
How to auto redirect a user in Symfony after a session time out?
In controller:
/**
* Bisdisp slide show preview action
*
* @param int $id
* @Route("/bisdisp/{id}/slideshow/", name="_get_bisdisp_slideshow", requirements={"id" = "\d+"})
* @Template()
*/
public function slideshowAction($id)
{
$power_plant = $this->getPowerPlant($id);
$response = new RedirectResponse($this->generateUrl('_get_bisdisp_slide1', [ 'id' => $id ]));
// $response->headers->set('Refresh', 5);
return $response;
}
/**
* Slide 1 view
*
* @param int $id
* @Route("/bisdisp/{id}/slideshow/slide1/", name="_get_bisdisp_slide1", requirements={"id" = "\d*"})
* @Template()
*/
public function slide1Action($id)
{
$power_plant = $this->getPowerPlant($id);
$response = new RedirectResponse($this->generateUrl('_get_bisdisp_slide2', [ 'id' => $id ]));
// $response->headers->set('Refresh', 5);
return $response;
}
/**
* Slide 2 view
*
* @param int $id
* @Route("/bisdisp/{id}/slideshow/slide2/", name="_get_bisdisp_slide2", requirements={"id" = "\d*"})
* @Template()
*/
public function slide2Action($id)
{
$power_plant = $this->getPowerPlant($id);
$response = new RedirectResponse($this->generateUrl('_get_bisdisp_slide3', [ 'id' => $id ]));
// $response->headers->set('Refresh', 5);
return $response;
}
into my views:
<meta http-equiv="refresh" content="5">
{% block content %}
<h3>Slide index</h3>
{% endblock %}
<meta http-equiv="refresh" content="5">
{% block content %}
<h3>Slide 1</h3>
{% endblock %}
<meta http-equiv="refresh" content="5">
{% block content %}
<h3>Slide 2</h3>
{% endblock %}