Created
July 19, 2019 11:24
-
-
Save FabianSchmick/b7c58bfb33bed4fd9e9d326fe5205ecd to your computer and use it in GitHub Desktop.
Symfony receive content for ajax or normal request
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
{% block html %} | |
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
</head> | |
<body> | |
{% block body %}{% endblock %} | |
</body> | |
</html> | |
{% endblock html %} |
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 AppBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\Routing\Annotation\Route; | |
class DefaultController extends Controller | |
{ | |
/** | |
* @Route("/", name="default") | |
*/ | |
public function indexAction(Request $request) | |
{ | |
return $this->render('index.html.twig'); | |
} | |
} |
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
{% extends 'base.html.twig' %} | |
{% block html %} | |
{% if app.request.isXmlHttpRequest or embed is defined %} | |
{{ block('body') }} | |
{% else %} | |
{{ parent() }} | |
{% endif %} | |
{% endblock html %} | |
{% block body %} | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment