M
M
mauscode2018-12-01 21:23:36
Twig
mauscode, 2018-12-01 21:23:36

From PHP to twig template engine?

Hello! Please help someone who knows the twig template engine well.
There is a PHP code that needs to be translated into twig

<?php if ($sort === 'p.price') { ?>
        <div class="catalog__sort__item catalog__sort__item_active">
          <?php if ($order === 'ASC') { ?>
          <span class="catalog__sort__item__span" onclick="location = '<?php echo $sorts['price'][1]['href'] ?>'"><?php echo $sorts['price'][0]['text']; ?><i class="catalog__sort__icon catalog__sort__icon_active catalog__sort__icon_<?php echo $sorts['price'][0]['order'] ?>"></i></span></span>
          <?php } else { ?>
          <span class="catalog__sort__item__span" onclick="location = '<?php echo $sorts['price'][0]['href'] ?>'"><?php echo $sorts['price'][0]['text']; ?><i class="catalog__sort__icon catalog__sort__icon_active catalog__sort__icon_<?php echo $sorts['price'][1]['order'] ?>"></i></span></span>
          <?php } ?>
        </div>
      <?php } else { ?>
        <div class="catalog__sort__item">
          <span class="catalog__sort__item__span" onclick="location = '<?php echo $sorts['price'][0]['href'] ?>'"><?php echo $sorts['price'][0]['text']; ?><i class="catalog__sort__icon catalog__sort__icon_<?php echo $sorts['price'][1]['order'] ?>"></i></span></span>
        </div>
      <?php } ?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question