My problem is the same as in this question but my error page won't extend base.html.twig. base.html.twig doesn't seems to be the problem. When i try to extend base layout, I get ResourceNotFoundException. In other twig layouts specific to a ceratain bundle, it works but if I try to override error template, it throws this error.
The key problem is probably the ResourceNotFoundException but i know I'm extending it the right way...
extends '::base.html.twig'
I'm not new to Symfony2 and I've used template inheritance quite alot. If i try to run the error page without extending the base layout, the error page shows. I've done all the cache clearing, I've run it in the prod environment but the page won't extend the base layout.
Anyone knows what could be the problem? Is there any other way that i could get the resource to the error template or debug to see what path is Symfony looking for when searching base.html.twig but cannot find one?
Related
I am currently trying to extend Place (custom dataobject) with silverstripe addressable module. However, I got the below error:
[User Error] collateDataFields() I noticed that a field called 'LatLngOverride' appears twice in your form: '(unknown form)'. One is a 'CheckboxField' and the other is a 'CheckboxField'
Addressable module works for Page class object but not dataobject class.
Does anyone have any idea what is this error about?
Thanks.
For people who is facing this problem, the author has fixed it in the latest commit.
https://github.com/silverstripe-australia/silverstripe-addressable/commit/2dbd6f7013561e4135850ee81999ece22ca73498
I have installed the HerzultFourmBundle into my Symfony2 application, added the calls in the app kernel and auto load and extended the base classes. The problem i am having is i have a site layout that is applied to every page in the application and i want to render the forum within this.
I am very new to Symfony and PHP, but i have tried a few ways to get this working. I have a controller method set up that will render the forum page correctly which is set through the normal routing configuration, i can also set it up so that is routes to the index method in the Forum controller in the Herzult forum bundle. However this renders the default styles for the forum index page and is not contained by the layout i require.
Can someone provide me with an example of how to implement the forum and integrate it into a site? A simple example would point me in the right direction.
If you look at bundle's main layout file you'll notice that it extends '::base.html.twig' template:
{% extends '::base.html.twig' %}
This is an application level template located in apps/Resources/viewsbase.html.twig file.
You should be able to define your custom stuff as long as you're using this template.
This is a convention called "Three level template inheritance". Read more about it in the documentation: http://symfony.com/doc/2.0/book/templating.html#three-level-inheritance
Note that HerzultForumBundle is currently under intensive development. Some features might be missing.
I have been developing with CakePHP and the Alaxos ACL plugin has helped in tremendously.
However, I am facing one issue I am not sure how to fix it?
I added a plugin named 'pages', but I cannot get ACL to see it so it is added to the list of allowed/denied actions.
If I access the plugin thru domain.com/pages/pages I get the following error
DbAcl::check() - Failed ARO/ACO node lookup in permissions check.
When I check thru the ACL plugin display, there is no reference to the pages controller and if I run the ACL build function, it simply says that there is nothing to add.
Is it because this controller is named pages and there is already a pages controller within Cake?
If it is how do I fix it? Is my only option, at this time, adding this manually to the Db? Should I go thru this plugin and rename pages to something else? or is there anything else I should be doing?
Thanks,
I see two things here. First like you suspect, having two classes in your application that share the same name is a bad idea. It will likely give you some problems in one way or another, with the wrong class being instantiated or whatever. As far as Cake does not use namespaces, this is not recommended.
Then, even if you change this name, there will be another problem if the controller you want to manage with ACL is the 'default' controller (a controller that has the same name as the plugin). There was an issue with the ACO nodes retrieval when the path contains twice the same name, which is the case for plugins default controllers.
controllers/Pages/Pages/index
So I decided to just skip the plugins default controllers from the controllers supported by the ACL plugin.
If you are the author of this plugin, you could rename it (because PagesController exists already), and move the actions in some other controller than the default controller.
I'm programming my first site in symfony2, a site including some bundles for handling articles and static pages or contact page. I'e also created a bundle (backend only for now) for handling ads to show in the site, but this ads must to be shown in ever frontend page request, so I need to understand how to execute the necessary code to retreive the ads to show and pass this information at all the frontend controllers I have in mine bundles.
Can you help me?
Thanks in advance
Robert
Depends where do you keep your ads, but sounds like a job for service container.
Basically you need to write a service that implements method to fetch the required ads and then call that service in the controllers ($this->get('service_name'))
See Embedding controllers within a twig template.
http://symfony.com/doc/current/book/templating.html#embedding-controllers
Basically if you want to include a global widget, you'll have to add it to the parent twig template in which your controller's template inherits.
Could someone tell what is good logic for creating custom helper for Views?
What I would like to accomplish is...
load header
load main navigation (static for all pages)
load some widgets etc. (static for all pages)
load content/main pages (dynamic)
and in the end, load footer of course
Could someone point me to the solution?
Thanks a lot, in advance!
This question gives some explanation to the method dqhendricks describes. It includes code examples showing how to use $this->load->view() to return the view to a variable instead of outputting it to the browser, how to include sub-views, and using a specific view as your main template. It's the best way I've found of handling view logic. Getting the hang of CodeIgniter - Templating / loading views
Some people will create a master template, then pass the sub content's view name in the data object. The master template will call the header view, footer view, etc, and use the data array to dynamically display the correct sub content view.
For a Template library that is more actively developed than Collin's (linked by predrag.music) try out mine:
https://github.com/philsturgeon/codeigniter-template
His is good but this supports modules, themes, mobile version variations of themes and plenty more.
you could use inheritance chaining (with a custom controller class or with an included extra class that extends controller that you extend from your controllers instead of the controller class) to make a common controller hub for all pages that has a method for the top stuff, and a method for the bottom stuff.
If you need something for the reference this one is good:
http://williamsconcepts.com/ci/codeigniter/libraries/template/reference.html