| 1 | <?php | ||
| 20 | class demo extends Controller | ||
| 21 | { | ||
| 22 | /** | ||
| 23 | * @return Response | ||
| 24 | */ | ||
| 25 | public function highlightDemoAction() | ||
| 26 |     { | ||
| 27 |         $root = dirname($this->get('kernel') | ||
| 28 |                              ->locateResource('@MesHighlightBundle/MesHighlightBundle.php')); | ||
| 29 | |||
| 30 | // Change root path for "code files". | ||
| 31 |         $this->get('mes_highlight.highlighter') | ||
| 32 | ->setRootPath($root); | ||
| 33 | |||
| 34 | // Add js language for highlighting. | ||
| 35 |         $this->get('mes_highlight.highlighter') | ||
| 36 | ->addSupportedLanguages(array( | ||
| 37 | 'js', | ||
| 38 | 'xml', | ||
| 39 | 'http', | ||
| 40 | )); | ||
| 41 | |||
| 42 |         $content = '{{Resources/demo/demo.php}}'; | ||
| 43 | |||
| 44 |         return $this->render('MesHighlightBundle::demo.html.twig', array( | ||
| 45 | 'content' => $content, | ||
| 46 | )); | ||
| 47 | } | ||
| 48 | } | ||
| 49 |