I am working with Sylius e-commerce (Symfony 2), and I want to know is it possible to check is my route accessed.
For example if I have 3 kind of routes :
../aboutus.. /home.. /contact
and how I could check if my /home is accessed so I can do some actions about that.
Thanks,
Cheers
I think that I've found solution to this, in a twig.template you can do this:
{{ app.request.get('_route') }}
that returns path of accessed route
Related
I am using sulu minimal edition.
So i want to create bundle for my custom controllers.
I have contact form in my website.
On form submit i want redirect to symfony route.
Save data in custom table and display in admin area user role wise. Whats best way?
I follow http://blog.sulu.io/how-to-develop-a-bundle-in-the-sulu-admin-1
but php on ./bin/websiteconsole debug:router my new routes created in controller not showing.
Sounds like you use annotations. Dit you try defining your route with XML?
As far as I know annotation - and XML defined routes can't be mixed within the same bundle (some please correct me if I'm wrong). Since Sulu uses XML I'd stick to that for the sake of consistency.
I am new to Symfony and Sylius, and I have installed Sylius which is installed as a symfony "vendor" bundle by default.
I have moved the route to Sylius (which is accessible by default at "/") to "/shop", and I will developp myself the home page and other pages (not related to the shop, like information pages, etc.)
But, I need authentication in these other pages to manage user accounts (with data not related to the shop).
What I would like is a shared authentication system, but I don't know if it is possible to use Sylius' one and how to do this.
Thanks for you help !
Jon
THis is related to Symfony, you will need to override security in way to share context - your app and Sylius. Then some parts of Sylius will be locked as now.
http://symfony.com/doc/current/security.html
What I have made is route my Bundle under "/admin/blog". As my route is under /admin, I have to authenticate with the Sylius authentication, and it Seems to work well ! :-)
I'm trying to write a plugin that would add these endpoints GET, POST, DELETE /api/checked to access the plugin's custom table.
Is it possible for a Wordpress plugin to expose a RESTful API? I can't seem to find any examples or documentation.
The closest thing I found was add_rewrite_rule. I was able to create http://www.blog.com/api, but how do I determine the HTTP verb?
You can use WP REST API. Just install it and then go to settings -> permalink and add /%postname%/ on the last field.
then you'll have everything you need at [url]/json-api/
Here is the doc
You can use JSON-API WordPress plugin for creating the web-services that can be used for fetching the data from Wordpress.
And the plugin will provide the webservice url something like that :
www.mysite.com/api/servicename
Plugin link : https://wordpress.org/plugins/json-api/
Hope it helps you some extent.
Is there a known tutorial that shows how to create a plugin system for symfony2?
Something like the big cms' have, a folder in the root directory where you can place your plugins.
Google just made a fool with me because the symfony1 bundles were called "plugins".
I imagine plugins to be just bundles, but not in the src but in the new plugins one.
They should be registered at runtime.
I believe you can use Event Dispatcher from Symfony to achive want you want. The below link might help you.
http://symfony.com/doc/master/components/event_dispatcher/introduction.html
I don't have any guide to explain how to use this for plugin system as I am personally looking for it.
How can I force FOSUserBundle to render all its pages as a part of my global template.
i tried to insert layout.html.twig from FOS UB to {% block login %} in my ::base.html.twig file which is above my default content in {% block body %}. when user enters page and logs in its ok but if he make for example password error he see only login form not the whole page.
I have also overriden layout of FOS UB to extend ::base.html.twig but how to make next steps?
Check Override template section of the doc.
Edit
Login action redirection is done by Symfony's internal Authentication/firewall system. If you enter wrong password the Symfony automatically redirects to login action you defined in firewall. For more info you can check Security section of the book. In this case you have to modify login.html.twig of FOSUserBundle to use your base template.