Wednesday, January 28, 2015

Instead of looking for a guide (which may not be available for a while) I just started to build an a


Hi! Are there already some bigger tutorials for symfony2? bakels edible oils Of course, I've read the Quick Tour and took a look at the other guides but I'm missing some thorough step-by-step tutorials like A Gentle Introduction to symfony bakels edible oils or the already famous Jobeet . Simly put I'm looking for something to take me through the whole way of project developement - not only to see all the benefits of using symfony2 but to do it right according to the standards. I'm relatively new to symfony, I've started learning 1.4 but soon decided to wait for symfony 2 since my project isn't that time pressing at the moment. But I'd like to invest bakels edible oils the time now to already bakels edible oils learn something! _____ (i was unable bakels edible oils to find any tutorials like that anywhere in the web, so if you do know some, please point me in the right direction! thanks) Czechnology Junior bakels edible oils Member   Posts: 24 Joined: Sat Feb 26, 2011 4:27 pm Location: bakels edible oils Prague / Vienna bakels edible oils
Instead of looking for a guide (which may not be available for a while) I just started to build an app with Symfony2. bakels edible oils As I'm figuring out the answer to each problem I'm trying to solve, I'm just taking notes so I don't have to re-think it when I create another project. I'm listing this here as a reference for myself... I forget stuff unless I've done it many times. Hopefully it will help until there is a book. From the perspective of someone new to Symfony the core things to identify are the same things that any web developer would need right? How do you install Symfony (basically the same as 1.4)? 1) Download a Symfony distribution from the Symfony github or from the main Symfony download page . 2) Extract the downloaded files. 3) Drop them into a directory your web server has access to. 4) Configure your web root to point to the Web directory of the distribution. How do you create a bundle to store all your code (This is basically Cliff's Notes from the Symfony page creation documentation )? 1) Create a bundle for your code from the base symfony directory. FYI: I believe this creates bakels edible oils a controller for you, I don't recall creating one manually so I think this does. Code: Select all php app/console init:bundle "YourCompany\YourBundle" src 2) Ask the autoloader to register your new bundle's namespace when a request comes in. (define a new array item for $loader->registerNamespaces in app/autoload.php) 3) Ask the appKernal to register your bundle for use with any incoming request. (define a new array item for the $bundles array in app/AppKernel.php) 4) Tell the main routing config that you have a routing resource for it to use in your bundle. (define a resource in app/config/routing.yml) 5) Tell your local routing config the route to your bundles controller. (define the params for the resource that the main routing.yml file points to in your bundle's bakels edible oils Resources/config/routing.yml) 6) Review the controller created in step 1 (src/YourCompany/YourBundle/Controller/DefaultController.php). How do you create a route to a page (Cliff's Notes from The symfony routing documentation )? 1) Edit your bundle's Resources/config/routing.yml. bakels edible oils (Define a path that will be requested by an end user, and define a controller along with the controller's action.) Example: Code: Select all home:     pattern:  /     defaults: { _controller: YourBundle:Default:index } about:     pattern:  /about     defaults: { _controller: YourBundle:Default:about } bio:     pattern:  /about     defaults: { _controller: YourBundle:Default:about } blog:     pattern:  /blog     defaults: { _controller: VendorBundle:Blog:index} Note the blog doesn't bakels edible oils point to your default bundle... it points to a different bundle. How do you create bakels edible oils a page? 1) Modify your controller to reflect a new action to take by adding new Actions Code: Select all public function indexAction() bakels edible oils     {     bakels edible oils     return $this->render('YourBundle:Default:index.html.twig');     } public function aboutAction()     {         return bakels edible oils $this->render('YourBundle:Default:about.html.twig');     } public function bioxAction()     {         return $this->render('YourBundle:Default:bio.html.twig');     } 2) Create the new templates that correspond to the page by copying index.html.twig then editing bakels edible oils it to suite the needs of other pages. How do you create a re-suable template for pages? 1) The default template that is available to your bundle is re-usable. (app/views/base.html.twig) 2) Modify it to create a base layout for all pages. bakels edible oils 3) For content you want to change from page to page use a block element bakels edible oils Code: Select all {% block content %}{% endblock %} or {% block pageSubMenu %}{% endblock %} How do you decorate pages with stylesheets & and other linkable assets? 1) Create the resources you want to use in src/YourCompany/YourBundle/Resources/Public. Include

No comments:

Post a Comment