Answer the question
In order to leave comments, you need to log in
What about routes?
Hello! In the main page view file, I have a menu with this code:
<ul id="nav">
<?php foreach($categories as $category):?>
<li>
<a href="<?= $this->url('shop/category', ['id' => $category->getId()]);?>"><?php echo $this->escapeHtml($category->getCategory());?></a>
<?php if (isset($category->children)):?>
<ul>
<?php foreach($category->children as $item):?>
<li>
<a href="<?= $this->url('shop/category', ['id' => $item->getId()]);?>"><?php echo $this->escapeHtml($item->getCategory());?></a>
</li>
<?php endforeach;?>
</ul>
<?php endif;?>
</li>
<?php endforeach;?>
</ul>
zblog.local/shop/category/1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question