Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't override extended twig template block to empty
    primarykey
    data
    text
    <p>I'm using <em>MopaBootstrapBundle</em> in <em>Symfony 2.1.3</em> with <em>Twig</em> templates. This bundle has <em>base.html.twig</em> template which contains scripts block:</p> <pre><code>{% block foot_script %} {# To only use a subset or add more js overwrite and copy paste this block To speed up page loads save a copy of jQuery in your project and override this block to include the correct path Otherwise the regeneration is done on every load in dev more with use_controller: true #} {% javascripts 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-transition.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-modal.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-dropdown.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-scrollspy.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-tab.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-tooltip.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-popover.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-alert.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-button.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-collapse.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-carousel.js' '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-typeahead.js' '@MopaBootstrapBundle/Resources/public/js/mopabootstrap-collection.js' '@MopaBootstrapBundle/Resources/public/js/mopabootstrap-subnav.js' %} &lt;script type="text/javascript" src="{{ asset_url }}"&gt;&lt;/script&gt; {% endjavascripts %} {% endblock foot_script %} </code></pre> <p>I'm extending it in my template using:</p> <pre><code>{% extends 'MopaBootstrapBundle::base.html.twig' %} {% block foot_script %}{% endblock foot_script %} </code></pre> <p>But it still tries to load Bundle's <em>base.html.twig</em> template and I get:</p> <blockquote> <p>An exception has been thrown during the compilation of a template ("Unable to find file "@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-transition.js".") in "MopaBootstrapBundle::base.html.twig".</p> </blockquote> <hr> <p>What I've found out is, that if you extend it like this:</p> <pre><code>{% extends 'MopaBootstrapBundle::base.html.twig' %} {% block foot_script %} {% javascripts '@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-typeahead.js' '@MopaBootstrapBundle/Resources/public/js/mopabootstrap-collection.js' '@MopaBootstrapBundle/Resources/public/js/mopabootstrap-subnav.js' %} &lt;script type="text/javascript" src="{{ asset_url }}"&gt;&lt;/script&gt; {% endjavascripts %} {% endblock foot_script %} </code></pre> <p>Note the <em>typeahead.js</em></p> <p>I get:</p> <blockquote> <p>An exception has been thrown during the compilation of a template ("Unable to find file "@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-typeahead.js".") in "MopaBootstrapBundle::base.html.twig".</p> </blockquote> <p>If I remove just one line:</p> <pre><code>{% extends 'MopaBootstrapBundle::base.html.twig' %} {% block foot_script %} {% javascripts '@MopaBootstrapBundle/Resources/public/js/mopabootstrap-collection.js' '@MopaBootstrapBundle/Resources/public/js/mopabootstrap-subnav.js' %} &lt;script type="text/javascript" src="{{ asset_url }}"&gt;&lt;/script&gt; {% endjavascripts %} {% endblock foot_script %} </code></pre> <p>I get:</p> <blockquote> <p>An exception has been thrown during the compilation of a template ("Unable to find file "@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-transition.js".") in "MopaBootstrapBundle::base.html.twig".</p> </blockquote> <p>It still tries to load all the scripst from base template.</p> <p>Any suggestions how to override *foot_script* block to make it empty and not to load these JS files?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload