3 Replies - 231 Views - Last Post: 06 August 2012 - 07:31 AM

#1 Nwa9ja  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 04-July 12

Twig framework display issues

Posted 06 August 2012 - 07:12 AM

I want to be able to access the integer 17 in an array $cart containing this
array(1) { [17]=> int(1) }

This is my code

{% for c in cart %}
{{c}}
{% endfor %}

but I keep getting the value 1 instead of the integer 17.
What am I doing wrong?
Is This A Good Question/Topic? 0
  • +

Replies To: Twig framework display issues

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3466
  • View blog
  • Posts: 9,948
  • Joined: 08-June 10

Re: Twig framework display issues

Posted 06 August 2012 - 07:20 AM

you’re accessing the value not the key. check the twig documentation for looping over keys and values: http://twig.sensiola...c/tags/for.html
Was This Post Helpful? 1
  • +
  • -

#3 Nwa9ja  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 04-July 12

Re: Twig framework display issues

Posted 06 August 2012 - 07:28 AM

Thanks a lot Dormilich, you are a life saver :D
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3466
  • View blog
  • Posts: 9,948
  • Joined: 08-June 10

Re: Twig framework display issues

Posted 06 August 2012 - 07:31 AM

I just happen to know where to look first. *gg*
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1