I have to override this template for my view:
views-view-fields.html.twig
My view name: banner_bim
My view block name: Block_1
I tried with:
views-view-field--banner_bim.html.twig
views-view-field--banner_bim--page.html.twig
views-view-field--banner-bim.html.twig
views-view-field--banner-bim--page.html.twig
None of these templates override base field template.
Any idea?
The correct one was:
views-view-field--banner_bim.html.twig
The problem was not the name of the file, but the cache.
I deleted the "Render cache" but it was necessary to clear the entire cache to see the change.
Related
I created a basic page with a NID of 176. My basic page content type contains a field called field_banner_image.
In my templates directory I created a file called page--node--176.html.twig and the template works.
I saw a few threads where you can access the node content via {{ content.field_name }}, however, my content appears to NULL every time.
I managed to output the URL of my image field via:
{{ file_url(node.field_banner_image.entity.uri.value) }}
I feel like there has to be an easier/better way of doing this. Any suggestions? Why is content null in my twig templates?
If your template is named page--node--176.html.twig, it is actually a page template overriding the base page template page.html.twig, so you will have access to all page variables but not those in your node.
Although your node type is called "page", it is still a node, and the template for it would be node--176.html.twig which overrides node.html.twig.
In your node--***.html.twig you will have access to the content variable. Let me know if you need help.
I want to override the default SonataAdmin Template.
I create a standard_layout.html.twig in my Namespace/bundle/resources/views
(same structur, same file name, same content)
I copied all the content of the source template in my target template, i just edit some part of the target off course....and nothing
thanks for your help
Bye
You have the solution of bundle heritance http://symfony.com/doc/current/cookbook/bundles/inheritance.html which allows, not only override templates but methods too.
Or you have http://symfony.com/doc/2.0/book/templating.html#overriding-bundle-templates which focusing only on templates.
With this last, you can try to create :
app/Resources/SonataAdminBundle/views/CRUD/base_show_field.html.twig
I'm trying to override the FOSUserBundle Templates as show here:
https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_templates.md
I used the second method, I created my own bundle and put the templates in
myBundle/Resources/Views/Security/login.html.twig
and
myBundle/Resources/Views/Registration/register.html.twig.
both templates start with:
{% extends "::nologbase.html.twig" %}
where nologbase.html.twig is defined in app/Resourcer/views.
well, the first one (login) is correctly displayed but the second one (register) shows row html with no css.
I cleared the cache and I also tried to display only the extended template and compared the source code. it is exactly the same!
any idea?
thanks
I am trying to edit the default page view of a node in Drupal and i found the file called node.tpl.php but even if i change it, the node page on the site isn't updated...
So how can i update the node view page so i can added some text, images etc.. ?
I guess that node_show function () { } is the one that displays the node but the code there doesn't give me enough detail on where the HTML is created so i can it
You need to copy the file to your theme's templates folder and clear the cache out before you can use this file. The original file should be at root/modules/node/
You can also set a template up for a specific content type by copying the default node.tpl.php file and renaming it to node--CONTENT_TYPE_MACHINE_NAME.tpl.php
I have already a page template for the default view of a Plone site (main page).
How to define the default view of a folder? This default view should use a page template.
Try this:
navigate to the desired folder
add "/manage_propertiesForm" at the end of the url
in the resulting form add this property:
name: "layout"
type: "string"
value: the page template name without extension
Use the answers above if you want to set one of the default views (tabular, thumbnail, etc), but if you want to choose a particular content item for the default view of the folder, you can do it in the ZMI as suggested:
navigate to the desired folder
add "/manage_propertiesForm" at the end of the url
in the resulting form add this property:
name: "default_page"
type: "string"
value: the id of the content item
or do it programmatically in Python:
content_id = "Name of the Content Item"
folder.manage_addProperty('default_page', content_id, 'string')
Hope this helps!
Using the information and links send both by Giacomo Spettoli and by Mikko Ohtamaa, another guy from my work team was able to find a solution for our case:
do as indicated by Giacomo (navigate to desired folder, etc.)
include a new directive in the configure.zcml file (this was found by on of my team mate Mr. Mariano):
<browser:page for="OFS.interfaces.IFolder" name=<name of the page template file> class=<name of the class used by the above template file> permission="zope2.View" />
Thanks to Giacomo and to Mikko; their answers helped us solve this issue.