I am following the Symfony tutorial:
http://symfony.com/doc/master/cmf/tu...ntrollers.html
(It starts from :
http://symfony.com/doc/master/cmf/index.html
Tutorial :
http://symfony.com/doc/master/cmf/tu...roduction.html
)
1) Where i could get listed keywords used in "app/config/config.yml" and where i could get explained this file creation rules. It is easy to copy the tutorial, but i do not understand how to make this without tutorial.
For instance, they add the keyword: "controllers_by_class:" . Where is the documentation for this keyword used on config.yml?
2) How webpage "src\Acme\BasicCmsBundle\Resources\views\Default\p age.html.twig" is loaded? According the tutorial i make corrections in config.yml and default controller. None of them contain the name of the template. Thus it is not clear for me how program loads "page.html.twig" than i go to "http://127.0.0.1:8000/page/home".
3) I need the answers to the above questions in order i could by myself create the remaining configurations and controller actions. Tutorial gives one example and suggests to create the webpages, controller actions and configurations for the rest of the links. I have to be able to view the link=reference "my first post" in "http://127.0.0.1:8000/page/home". I am getting the error:
Expand|Select|Wrap|Line Numbers
- Unable to find the controller for path "/post/2015-10-16/my-first-post". The route is wrongly configured.
- 404 Not Found - NotFoundHttpException
<h1>{{ post.title }}</h1>
<p>{{ post.content|raw }}</p>[/code]
Than to retrieve "My First Post" contents from database (which is loaded to the database from the fixtures or by creating the post in the website) and render with this content the "post.html.twig" template?
How to make this? I believe it must be an action in the controller?
Expand|Select|Wrap|Line Numbers
- src\Acme\BasicCmsBundle\Controller\DefaultController.php
- ..
- public function postAction($contentDocument)
- {
- $dm = $this->get('doctrine_phpcr')->getManager();
- // how to know which post i have to find? If i go to url "http://127.0.0.1:8000/page/my-first-post", I need to retrieve the first post. Which function analise the url?
- $post = $dm->getRepository('AcmeBasicCmsBundle:Post')->find ??
- // what to return ?
- }
Do i need to make additional adjustments in config.yml?
Expand|Select|Wrap|Line Numbers
- simpleCMS\app\config\config.yml
- sonata_doctrine_phpcr_admin:
- document_tree_defaults: [locale]
- document_tree:
- Doctrine\ODM\PHPCR\Document\Generic:
- valid_children:
- - all
- Acme\BasicCmsBundle\Document\Page:
- valid_children:
- - Acme\BasicCmsBundle\Document\Post
- Acme\BasicCmsBundle\Document\Post:
- valid_children: []