I am looking to include a variable declared in JavaScript into the path for redirecting my page. Here is my code: var id = $(this).attr('data-id'); windows.location = {{ path("mylink", {id: id}) }}; Unfortunately, I am getting an error when trying to ...
The following twig loop is used to generate data: {% for reservationDate, rooms in data.pricingTable %} <tr> <td> {% for room in rooms %} <tr> <td ...
When working with Symfony 2.3 and Twig, I am facing the challenge of selecting remote assets within a Twig template. Within my Twig template, I have a body block structured like this: {% block body %} {% include 'http://asset.remotelocation.co.uk/tem ...
1) cms 2) cms_translations cms id url status cms_translations object_id title lang_id I have also created a cmsRepository file for handling this. $q = $em->createQuery("SELECT c , d FROM Dashboard\CmsBundle\Entity\Cms c JO ...
Is there a way to disable the rendering of HTML responses in Twig? I am currently working on a RESTful API and my goal is to completely prevent HTML rendering. For instance, if I access /foo/bar without an oAuth Access Token, Symfony2 should reply with a ...
I am trying to incorporate a JavaScript variable into Twig. Despite attempting to implement the solution mentioned here, my code below does not render the map properly. If I remove the part between "var polylineCoordinates" and "polyline.setMap(map);", th ...
Is it possible to include an icon in a post using the sw_icon command? For instance: {% sw_icon 'head' %} Are there any alternatives to using 'head' for this command? ...
When a Twig template contains an unset variable, the outcome is determined by the setting of strict_variables. There are two options available: false (default): The variable is treated as NULL, and the template continues to render. true: An exception is ...
I am trying to pass a JavaScript variable to a twig path but the current method I am using is not working as expected. <p id="result"></p> <script> var text = ""; var i; for (varJS = 0; varJS < 5; varJS++) { text += "<a href= ...
Can someone help me troubleshoot my issue with Symfony2? I'm new to this framework and struggling with a problem in my twig file. I have a form where I enter a test name and the names of its categories, along with a color for each category. However, w ...
I understand that utilizing innerhtml is generally considered a poor practice due to the potential for XSS vulnerabilities (). However, consider the scenario below: I have a webpage generated through a Twig template called index.html.twig. When using te ...
Currently, I am developing a custom administration module (plugin configuration) in Shopware 6 using Vue.js. An issue I am facing is the absence of an inherit wrapper that appears when there is a change in the sales channel. My goal is to replicate the s ...
Hey everyone, I'm currently working on passing an array to a JavaScript file and encountering this error: An exception has been thrown during the rendering of a template ("Notice: Array to string conversion"). What I need is: data: ['2017/7','2017/8'] ...
I have a task of redirecting to another page while passing along the value from a textfield. Here is my current code: {% extends "base.html.twig" %} {% block body %} <button onclick="host()">Host the session</button> <button onclic ...
Having recently subscribed, I have come to seek assistance on a platform where I have previously found many solutions to my issues. I have completed a course on Openclassrooms (Transitioning to a Professional PHP Architecture) which has equipped me with t ...
In my templates, I have the following code snippet for generating routes with parameters: <a class="btn btn-block btn-abcd" href="{{ path( 'auth.login', { 'type': constant('User::TYPE_CANDIDATE'), 'provider': constant('UserProvi ...
I am facing a situation where using Twig results in a blank page instead of showing a fatal error. I understand that this is related to the error reporting settings, and I have to explicitly set it to E_ALL for it to function properly. I have implemented ...
In my Symfony Form, I am attempting to display a SelectField with various icons. Here is what my ChoiceType looks like: ->add('icon', ChoiceType::class, [ 'choices' => [ '' => '', '' = ...
Can you access the $_SESSION variable in a .twig template in Craft CMS version 3.x? I've come across articles for version 2.5 but nothing specific to 3.x and above. Appreciate any help on this matter. Thanks. ...
I need assistance with implementing a button in my twig file within a table that will remove an element from an array. Ideally, I would like to remove the element based on its index. From the research I have conducted, it seems that data manipulation shou ...
When it comes to loading a CSS file based on the user's selected theme, I encountered an issue while trying to implement this in my Symfony application using Twig templates. The code worked flawlessly on a simple HTML page, but transferring it to a Twig te ...
I'm working on a Twig file where I need to create a table and populate it with data using a loop. The issue is that all my field names are the same, so I want to add a counter variable to differentiate them. How can I achieve this? Below is the code ...
Recently, I've delved into Symfony 4 and encountered an issue with rendering a form featuring a ChoiceType Field with numeric choices. The goal is to allow the user to select a specific number of tags. Here's a snippet from my controller: class ...
When utilizing twig to declare a variable called user: <script type="text/javascript> {% if user is defined %} var user = { example: {{ userjson | raw }} }; {% endif %} </script> If a user is not logged in, an error message a ...
Currently, I am utilizing the Twig-View feature of Slim framework from https://github.com/slimphp/Twig-View, to render Twig templates within my application. The detailed instructions provided on the respective pages make the integration process quite stra ...
Despite following the documentation meticulously, and experimenting with various methods, I am still unable to achieve success. I have attempted using the code snippet below, trying to reference the variable in the main file like this: // None of the opti ...