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 | |
// web/app.php | |
require_once __DIR__.'/../app/bootstrap.php.cache'; | |
require_once __DIR__.'/../app/AppKernel.php'; | |
//require_once __DIR__.'/../app/AppCache.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
$kernel = new AppKernel('prod', false); | |
$kernel->loadClassCache(); |
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 | |
if (!in_array(@$_SERVER['REMOTE_ADDR'], array( | |
'127.0.0.1', | |
'::1', | |
))) { | |
header('HTTP/1.0 403 Forbidden'); | |
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); | |
} | |
require_once __DIR__.'/../app/bootstrap.php.cache'; |
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 | |
// src/MyCompany/BlogBundle/Controller/BlogController.php | |
namespace MyCompany\BlogBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
class BlogController extends Controller | |
{ | |
public function viewAction($id) | |
{ |
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 | |
public function indexAction($name) | |
{ | |
$response = $this->forward('MyCompanyBlogBundle:Blog:show', array( | |
'id' => 30 | |
)); | |
return $response; | |
} |
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
# app/config/routing.yml | |
mycompany_routes: | |
resource: "@MyCompanyBundle/Resources/config/routing.yml" | |
prefix: /mycompany |
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
contact: | |
pattern: /contact | |
defaults: { _controller: MyCompanyBundle:Home:contact } | |
requirements: | |
_method: GET |
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
article_show: | |
pattern: /articles/{culture}/{year}/{title}.{_format} | |
defaults: { _controller: AcmeDemoBundle:Article:show, _format: html } | |
requirements: | |
culture: en|fr | |
_format: html|rss | |
year: \d+ |
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 | |
namespace Acme\DemoBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
class ArticleController extends Controller | |
{ | |
public function showAction($culture, $year, $title) | |
{ |
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
<!DOCTYPE html> | |
<html> | |
<head><?php echo $this->title; ?></head> | |
<body> | |
<?php foreach ($this->article as $article): ?> | |
<?php echo $article->getBody(); ?> | |
<!-- and so on and so on... --> |
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
<!DOCTYPE html> | |
<html> | |
<head>{{ title|raw }}</head> | |
<body> | |
{% for article in articles %} | |
{{ article.body }} | |
{# and so on and so on... #} |
OlderNewer