User Tools

Site Tools


symfony:symfony_tutorial_notes:create_your_first_page_in_symfony

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
symfony:symfony_tutorial_notes:create_your_first_page_in_symfony [2015/09/15 03:59] mithatsymfony:symfony_tutorial_notes:create_your_first_page_in_symfony [2015/09/17 23:38] (current) mithat
Line 1: Line 1:
 ====== Create Your First Page in Symfony ====== ====== Create Your First Page in Symfony ======
-====== TLDR ====== +===== TL;DR ===== 
-  * Controllers live in **''src/AppBundle/Controller''**. Use annotation to specify routes.+  * Controllers live in **''src/AppBundle/Controller''**.
   * Templates live in **''app/Resources/views''**.   * Templates live in **''app/Resources/views''**.
-  * **''app/''**: Contains things like configuration and templates. Basically, anything that is not PHP code goes here.+  * Use annotation in controllers to specify routes. 
 +  * **''app/''**: Contains things like configuration and templates--basically, anything that is not PHP code.
   * **''src/''**: Your PHP code lives here.    * **''src/''**: Your PHP code lives here. 
-  * **''web/''**: Document root for the project; contains any publicly accessible fileslike CSS, images and the front controllers (''app_dev.php'' and ''app.php'').+  * **''web/''**: Document root for the project; contains any publicly accessible files like CSS, images and the front controllers (''app_dev.php'' and ''app.php'').
   * **''vendor/''**: Third-party libraries and bundles downloaded by [[https://getcomposer.org/|Composer]].   * **''vendor/''**: Third-party libraries and bundles downloaded by [[https://getcomposer.org/|Composer]].
   * The main configuration file for bundles is **''app/config/config.yml''**.   * The main configuration file for bundles is **''app/config/config.yml''**.
Line 21: Line 22:
 { {
     /**     /**
-     * @Route("/lucky/number/{count}")+     * @Route("/lucky/number/{count}", name="lucky_number_count")
      */      */
     public function numberAction($count)     public function numberAction($count)
Line 32: Line 33:
  
         return $this->render(         return $this->render(
-            'lucky/number.html.twig', +            'lucky/number.html.twig', [ 
-            array('luckyNumberList' => $numbersList)+                'luckyNumberList' => $numbersList 
 +            ]
         );         );
     }     }
Line 159: Line 161:
 </code> </code>
  
-Templates live in **''../app/Resources/views''**:+Templates live in **''app/Resources/views''**:
  
 <file twig app/Resources/views/lucky/number.html.twig> <file twig app/Resources/views/lucky/number.html.twig>
symfony/symfony_tutorial_notes/create_your_first_page_in_symfony.1442289584.txt.gz · Last modified: 2015/09/15 03:59 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki