G
G
gog692016-08-17 13:35:02
symfony
gog69, 2016-08-17 13:35:02

How to make a frontend for a simple CMS?

There is a ready-made backend, there are services for extracting various content.
The task is to write a flexible frontend to display this content.
That is, calling urls like
/news
/My-First-Post
/Product/T-Shirt-white
/Company/About-Us
should extract some then the content and pass the necessary variables to the view,
map the url to the controller action and pull the methods of the services making the selections there (like I have now) I’m starting to dislike
the approach of the doctrine

public function(Post $post) {

}

i.e. the listener crashes, which fetches the post by ID and in the controller we already have this object,
but if I need to display something besides the content of the post, I have to pull the service again in the body of the controller to make an additional fetch
, so the idea was born
# routing.yml
single_post:
     route: /someregex
     defaults:
        _controller: viewcontroller:index
        template: singlepost.html.twig
        fetch: [ postContent ]

post_with_children:
     route: /someregex
     defaults:
        _controller: viewcontroller:index
        template: post_with_children.html.twig
        fetch: [ postContent, postChildren ]

news:
     route: /someregex
     defaults:
        _controller: viewcontroller:index
        template: news.html.twig
        fetch: [ lastNews ]

home:
     route: /someregex
     defaults:
        _controller: viewcontroller:index
        template: news.html.twig
        fetch: [ lastTreeNews, newProducts, homePostContent ]

specify through the configuration what should be prophesied before it gets into the
view controller?
how is it done in intelligent solutions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
semki_1, 2016-08-25
@semki_1

Take Codeigniter for example. For example, a page with the address product/cars/Audi will mean the controller - product, the method - cars, audi - the value of the field.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question