How do I route a static page in sylius - symfony

I am having tourble creating and routing static pages from within the Sylius CMS.
I have had this working once but now just can not get it to work at all. Creating the content for the page works fine but when I try to save a route all I get is errors.
An exception has been thrown during the rendering of a template
("Parameter "id" for route "sylius_backend_static_content_update" must
match ".+" ("" given) to generate a corresponding URL.") in
SyliusWebBundle:Backend/Content/StaticContent:update.html.twig at line
20.
Image of the page I am trying to save
Any help would be appreciated as there doesn't seem to be any documentation on this part of sylius.

May be you can have a look into the link below. I also had some problems with the routes while creating the pages. I had solved it by adding some info into the database. Hope this link helps you.
https://github.com/Sylius/Sylius-Standard/issues/78
Happy Syliusing ^^

Related

nested pages in strapi and nextjs

So we want to create a big website with nextjs and strapi.
We sometimes have deep nested pages like
www.ourwebsite.com/onderwijs/bijbelscholen/parttime-bijbelscholen
How is this possible?
I have tried to setup dynamic routing in nextjs which is working fine, but I have a problem.
If I want dynamic routes which are all nested I need to do something like this:
I know it's ugly, I'm sorry.
so now when I go to
www.ourwebsite.com/onderwijs/bijbelscholen/parttime-bijbelscholen
I just get the latest word from the URL and take that and put that into my API to get the right data which is working fine! I configured strapi so it finds by slug and not by id. So my API URL looks like this: www.myStrapiInstalation/api/pages/parttime-bijbelschool
but when I go to
www.ourwebsite.com/onderwijs/parttime-bijbelscholen
It's also working! but that's not good! Because it needed to give me a 404 page because it doesn't exist but now it just takes the latest word and gets the data from strapi. My API URL is still this of course: www.myStrapiInstalation/api/pages/parttime-bijbelschool
So what do I need to do?
Is it just not possible to make everything hardcoded and do I need to make nested folders with real names like: 'onderwijs', 'activiteiten' etc.
Or can I make everything dynamic so that people can make nested routes in nested routes in strapi?
I feel like this is a very stupid question, but I'm really stuck here.
Next JS allows catch-all routes, which is useful for nesting pages and have this format:
pages/post/[...slug].js
In your example, the pages folder structure would be:
pages/secondNest/[...page].js
However, since you're using Strapi to fetch the content, the routes of these pages should be known in advance so that if the user navigates to an invalid page, the result should be 404.
You can set the valid routes in Next with getStaticPaths. But notice that you will also need to set up a custom controller in your Strapi application to return the content tree of your website the way that getStaticPaths expects.
That way, it's ok to use the last part of the URL to get the content.
One disavantage of using catch-all routes, though, is that you must know the base of each URL. For example, if you have the following URLs
www.example.com/onderwijs/bijbelscholen/parttime-bijbelscholen
www.example.com/activiteiten/bijbelscholen/parttime-bijbelscholen
the folder structure in pages would be:
pages/onderwijs/[...page].js
pages/activiteiten/[...page].js
The key factor here is that the paths following the base of the URL should be set statically with the help of a custom controller that returns the tree of the content.

Editing already defined routes

I'm working on a dynamic project which is adding or changing the route urls.
For example:
I want to add sub application route like AppName/{controller}/{action}/{id}
or maybe a language information like {controller}/{action}/{id}/{language}
in this scenario, I can't touch to other routes and I have to override them.
I tried to foreach RouteTable.Routes and there is no editable values for added routes.
Thanks for any help.
I found the solution.
I cast the items in the RouteTable.Routes to Route object :)

Trying to override templates in FOSUserBundle, but having no effect

I'm trying to modify the skin of the register.html.twig template found in FOSUserBundle/Resources/views/Registration/register.html.twig.
I've basically followed the instructions in the documentation down to a T.
Like it told to do so, I created /app/Resources/views/FOSUserBundle/views/Registration/register.html.twig.
Cleared the cache (and browser cache just to be sure)
NO effect! I've put a blank file in register.html.twig, but no matter what I put there, when I go to /register/, I still see the default template.
Yep, these things happen all the time.
It should be:
/app/Resources/FOSUserBundle/views/Registration/register.html.twig
Reference

including controllers in Symfony2 issue

I am beginner at symfony and I've been confused about couple things, well my website has a header where user can search,select language and manage his account and i have a navigation menu and a footer that is common between all my website pages , so i created a commonbundle where i put the common code for header and menu and footer i also created a global layout where i included my header controller,menu controller and footer controller, i don't know if this approach is correct and im already having problem about how to do following stuff:
include the search bundle in my header
get the current request in header as it returns a subrequest
generate url in my header because i have no route for it as it doesn't suppose to have one because we'll never call it .
You can follow this to help with setting up fragments:
http://symfony.com/blog/new-in-symfony-2-2-the-new-fragment-sub-framework
As for getting the top level request, try:
$this->container->get('request');
i did a search about it and found that : you cannot redirect from an embedded controller as we only get the response content. With the current architecture, I don't think it is even possible and anyway, I'm not sure we want to support this feature.
https://github.com/symfony/symfony/issues/2517

Am I able to create a taxonomy/term/%/x view path using the term alias?

I have enabled the built in taxonomy/term/% view
I have created a display with path /taxonomy/term/%/test
I also have a URL alias setup on the taxonomy/term path to be /fruits/apple
So I would expect this to work /fruits/apple/test would display my view.
When I browse to this path I get Page not found.
If I browse to the un-aliased path ie /taxonomy/term/156/test it works.
Should the alias work like this?
Ive tried every combination I can think of. Reenabled the view, created new displays, removed all other displays etc
Try this: Path redirect. If itsn't help, rewrite engine help to you.
Try sub-pathauto module.
This module extends that behavior by also matching known sub-paths and
replacing them with their respective alias.
For example, if user/1 is aliased to users/admin, this module rewrites
the link to the user contact page user/1/contact to use the aliased
URL users/admin/contact instead.

Resources