Hi,
I was reading on the net and could not find how to implement as loop something like
twig's

<ul id="navigation">
        {% for item in navigation %}
            <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
        {% endfor %}
  </ul>

I want to have idea of what is going on!

Recommended Answers

This might give you some starting points (https://github.com/fabpot/Twig/blob/master/lib/Twig/TokenParser/For.php) also take a look at the TokenParser classes at the bottom of this directory. (

Jump to Post

All 3 Replies

If my guess is right, we can use a Dot notation array access class. In addition, an array can be nested within an array deeper than what we can normally do without the dot notation class.

Then we can implement the loop the way twig and smarty implement their loops.

If my guess is right, we can use a Dot notation array access class. In addition, an array can be nested within an array deeper than what we can normally do without the dot notation class.

Then we can implement the loop the way twig and smarty implement their loops.

I have not understood what you have said. can you elaborate?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.