Created
May 2, 2012 11:56
-
-
Save coreymcmahon/2576072 to your computer and use it in GitHub Desktop.
Some Symfony controller code rendering a blog article using a Twig template - http://www.symfonycentral.com
This file contains 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 | |
# src/MyCompany/BlogBundle/Controller/ArticleController.php | |
namespace MyCompany\BlogBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
class ArticleController extends Controller | |
{ | |
public function viewAction($id) | |
{ | |
$article = /* build article from model in here */; | |
return $this->render('MyCompanyBlogBundle:Article:view.html.twig', | |
array('article' => $article->getBody())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment