SHARE
TWEET

Untitled

a guest Jun 25th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ php bin/console make:controller DefaultController
  2.      
  3. // ...
  4. class DefaultController extends Controller
  5. {
  6.     /**
  7.      * @Route("/")
  8.      */
  9.     public function new(Request $request)
  10.     {
  11.  
  12.         // ...
  13.         return $this->render('default/new.html.twig', [
  14.             'default' => $default->createView(),
  15.         ]);
  16.     }
  17. }
  18.      
  19. // ...
  20.   /**
  21.    * @Route("/")
  22.    */
  23.   public function new(Request $request)
  24.   {
  25.     // ...
  26.     return $this->render('base.html.twig', [
  27.         'default' => $default->createView(),
  28.     ]);
  29.   }
  30. // ...
  31.      
  32. <html>
  33.   <head>
  34.      <title>{{ title }}</title>
  35.  
  36.       {% block stylesheets %}
  37.            <link href="{{ asset('css/base.css') }}" rel="stylesheet"/>
  38.         {% endblock %}
  39.   </head>
  40.  
  41.   <body>
  42.     {% block header %}
  43.        <div>Верстка общего хидера</div>
  44.     {% endblock %}
  45.  
  46.     {% block content %}{% endblock %}
  47.  
  48.     {% block footer %}
  49.        <div>Верстка общего футера</div>
  50.     {% endblock %}
  51.  
  52.     {% block javascripts %}
  53.         <script src="{{ asset('js/base.js') }}"></script>
  54.     {% endblock %}
  55.   </body>
  56. </html>
  57.      
  58. {% extends 'base.html.twig' %}
  59.  
  60.  {% block stylesheets %}
  61.      {{ parent() }}
  62.       <link href="{{ asset('css/new.css') }}" rel="stylesheet"/>
  63.  {% endblock %}
  64.  
  65.  {% block javascripts %}
  66.      {{ parent() }}
  67.       <script src="{{ asset('js/new.js') }}"></script>
  68.  {% endblock %}
  69.  
  70.  {% block content %}
  71.      <div>разметка контента</div>
  72.  {% endblock %}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top