Dave Mascia
Dave Mascia

Reputation: 1364

Directory Path in Twig

In my twig file i have a JS method that needs a path to flash files located in web/bundles/bm/swf/.. I don't need to load a specific file just point the method to that path.

{% block javascripts %}

    {{parent()}}
    <script type="text/javascript" src="{{ asset('bundles/bm/js/soundmanager2.js') }}"></script>

    <script>

        soundManager.url = ''; < needs the path to web/bundles/bm/swf/
        soundManager.onload = function() { }

    </script>
{% endblock %}

Any idea?

Upvotes: 0

Views: 3095

Answers (1)

Dave Mascia
Dave Mascia

Reputation: 1364

{% block javascripts %}
    {{parent()}}
    <script type="text/javascript" src="{{ asset('bundles/bm/js/soundmanager2.js') }}"></script>

    <script type="text/javascript">
        soundManager.url = '{{ asset('bundles/bm/swf/')}}';
        soundManager.onload = function() { }
    </script>
{% endblock %}

Upvotes: 1

Related Questions