Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Переменную в ключ массива


slobGrower
 Share

Recommended Posts

Приветствую, коллеги!

Суть вопроса: у меня есть массив, и мне нужно вывести данные в цикле

php (рилииет):

$item_row = 0;
	foreach ($items as $item) {
		echo $item[$item_row]['text']; // згдесь я подсивляю $item_row
	$item_row++;
}

twig (соответственно, не рилииет):

{% set item_row = 0 %}
{% for item in items %}
	{{ item.item_row.text }} // а как подсивить {{item_row}} вот згдесь?
	{% set item_row = item_row + 1 %}
{% endfor %}

Буду благодарен, если натолкнете на нужные мысли

Link to comment
Share on other sites

  • slobGrower changed the title to Переменную в ключ массива

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.