{% for key, val in activity.meta %} <div class="box-item"> {{% if key=="date" }} good times {{ %endif %}} <strong>{{key}}</strong>:<span>{{val}}</span> </div> {% endfor %}
The "for" loop works fine (this is a working app that I've been asked to do so changes on). What I need to do is capture the date (see screenshot below) and reformat it. I'm spitting in the wind, though, as far as how the data is actually being processed.
When I run the above code, I get this error:
Error compiling twig template C:\wamp64\www\bSmart\views\partials\company-slide-out\history-tab.html.twig:
TwigException: Unable to parse 'if key=="date"' at template position1
Error parsing twig template C:\wamp64\www\bSmart\views\companies-edit.html.twig:
TypeError: Cannot read property 'length' of undefined
So, I'm thinking "date" is not the name of the key. So, how do I determine the name...?
Is there a way to view the array as it's coming to the twig file so I can see the key->value pairs and know what those keys are specifically?
If this was a JS file, I would do a console.log. Right now, while I have an idea as to where the data is coming from, I'm not certain at this point and that may be another question for EE down the road.
Is there a way to see the raw data in the context of a twig file?
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
-Mike Kapnisakis, Warner Bros
With your subscription - you'll gain access to our exclusive IT community of thousands of IT pros. You'll also be able to connect with highly specified Experts to get personalized solutions to your troubleshooting & research questions. It’s like crowd-sourced consulting.
We can't always guarantee that the perfect solution to your specific problem will be waiting for you. If you ask your own question - our Certified Experts will team up with you to help you get the answers you need.
Our certified Experts are CTOs, CISOs, and Technical Architects who answer questions, write articles, and produce videos on Experts Exchange. 99% of them have full time tech jobs - they volunteer their time to help other people in the technology industry learn and succeed.
We can't guarantee quick solutions - Experts Exchange isn't a help desk. We're a community of IT professionals committed to sharing knowledge. Our experts volunteer their time to help other people in the technology industry learn and succeed.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Fellow title is reserved for select members who demonstrate sustained contributions, industry leadership, and outstanding performance. We will announce the experts being inducted into the Experts Exchange Fellowship during the annual Expert Awards, but unlike other awards, Fellow is a lifelong status. This title may not be given every year if there are no obvious candidates.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.