# Create route/view/controller dynamically using a dashboard with slim PHP

**URL:** https://discourse.slimframework.com/t/create-route-view-controller-dynamically-using-a-dashboard-with-slim-php/1845
**Category:** Questions
**Created:** [September 30, 2017, 1:05pm UTC](https://discourse.slimframework.com/t/create-route-view-controller-dynamically-using-a-dashboard-with-slim-php/1845 "2017-09-30T13:05:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![elshobokshy](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/elshobokshy/32/495_2.png) [@elshobokshy](https://discourse.slimframework.com/u/elshobokshy)
#### Post date: [September 30, 2017, 1:05pm UTC](https://discourse.slimframework.com/t/create-route-view-controller-dynamically-using-a-dashboard-with-slim-php/1845/1 "2017-09-30T13:05:40Z")

</div>

What I can do :

Create a dashboard using eloquant with slim to be able to create for example a gallery with photos. The dashboard will contain all the created galleries, each gallery with a link to the gallery’s page.

Problem :

I can’t figure out how, with slim, I could add a button on the dashboard that will automatically upon submitting the button :

- Create a route :

`$app->get('/gallery1', 'GalleryController:gallery1')->setName('gallery1');`

- Create a view called gallery1.html.twig

- Update GalleryController.php to add a function to generate that view :

I’m new to Slim, sorry.

---

<div class="post-metadata">

### Author: ![tstadler](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tstadler](https://discourse.slimframework.com/u/tstadler)
#### Post date: [September 30, 2017, 5:34pm UTC](https://discourse.slimframework.com/t/create-route-view-controller-dynamically-using-a-dashboard-with-slim-php/1845/2 "2017-09-30T17:34:16Z")

</div>

you could crate a generic:

$app-\>get(’/gallery/{id}’, ‘GalleryController:gallery’);

in your GalleryController:gallery you can access the id with $args[‘id’], and display the photos belonging to gallery $id.
