473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Symfony, CMS tutorial. How to know config.yml syntax? How routes are mapped?

103 100+
There are three questions.

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
  1. Unable to find the controller for path "/post/2015-10-16/my-first-post". The route is wrongly configured.
  2. 404 Not Found - NotFoundHttpException 
As far as i understand i have to create "src\Acme\BasicCmsBundle\Resources\views\Default\p ost.html.twig".

<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
  1. src\Acme\BasicCmsBundle\Controller\DefaultController.php
  2. ..
  3.     public function postAction($contentDocument)
  4.     {
  5.         $dm = $this->get('doctrine_phpcr')->getManager();
  6.  
  7. // 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?
  8.        $post = $dm->getRepository('AcmeBasicCmsBundle:Post')->find ??
  9.  
  10.      // what to  return ?
  11.     } 


Do i need to make additional adjustments in config.yml?
Expand|Select|Wrap|Line Numbers
  1.  simpleCMS\app\config\config.yml
  2.     sonata_doctrine_phpcr_admin:
  3.     document_tree_defaults: [locale]
  4.     document_tree:
  5.         Doctrine\ODM\PHPCR\Document\Generic:
  6.             valid_children:
  7.                 - all
  8.         Acme\BasicCmsBundle\Document\Page:
  9.             valid_children:
  10.                 - Acme\BasicCmsBundle\Document\Post
  11.         Acme\BasicCmsBundle\Document\Post:
  12.             valid_children: [] 
  13.  
Oct 16 '15 #1
0 1118

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Leif Wessman | last post by:
I have a BOOKS table with the columns ISBN and TITLE. I have a list of 5 isbn-numbers and I would like to find out their titles if they are in the database, or null if they are not. In other words,...
2
by: Patty O'Dors | last post by:
with all the xml fiends out there there must be someone who has figured this out. I can use "jobs/job" to specify all "job" elements that are children of the "jobs" main element that have the...
3
by: msnews.microsoft.com | last post by:
Hello. I have this code in a project named ProductsHandler: First, a class called ProductsHandler.vb (this particular code is not important in this question, because the class is correct - it...
6
by: J.S. | last post by:
Is it safe to have the database username and password in the web.config file? Thanks, J.S. --
6
by: Bob | last post by:
The web.config file is a pure XML file. Would people who visits my website built on ASP.NET 2.0 be able to access my web.config file? i.e. can they do http://mywebsite/web.config ? I'm...
8
by: EPPack | last post by:
I have a full, legal copy of Visual Studio.net 2003 on my work machine, I don't need the free product that was suggested , (unless it has a built in tutorial). However, I have no major clue how to...
2
by: Pierre Couderc | last post by:
Generally, is there somewhere a good tutorial and examplefor the use of SGI STL hash_set? I am lost in SGI documentation. More specifically, i am trying to use hat I need that a hash_set : ...
2
by: V Rajagopalan | last post by:
can anyone help me to know the syntax being used in javascript and its functions,Properties. For example, when we write code like "text1" followed by "dot" in VB lt display some properties like that...
0
by: Jeff Dege | last post by:
Suppose I have two .NET applications that use different versions of the same private assembly, and these two applications _must_ be placed in the same directory. Can I get each to reference the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.