-
-
Save mrsinguyen/bb8c2f7216efea036a9b05ed1f95edd0 to your computer and use it in GitHub Desktop.
Render XML-Data using Twig-Template within the SILEX-Microframework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add to use-statements | |
| use Symfony\Component\HttpFoundation\Response; | |
| // [...] Your application code | |
| // Action to return XML from Twig-Template | |
| $app->get( | |
| '/sitemap.xml', | |
| function () use ($app) { | |
| $data = array(); | |
| return new Response($app['twig']->render( | |
| 'sitemap.xml.twig', // Your twig-template eg. sitemap.xml.twig | |
| array('data' => $data) | |
| ), | |
| 200, | |
| array('Content-Type' => 'application/xml') | |
| ); | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment