2
0

twig.html.twig.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php $this->extend('base.html.twig.php'); ?>
  2. <?php $user = "Alice"; ?>
  3. <?php $discount = 15; ?>
  4. <?php $initialPrice = 200; ?>
  5. <?php $isMember = true; ?>
  6. <?php $items = 5; ?>
  7. <?php $bonusPoints = 50 ? $isMember : "tata"; ?>
  8. <?php $toto = ['toto']; ?>
  9. <?php $toto2 = new stdClass(); ?>
  10. <?php echo $isMember ? $__filters['lower']($__filters['upper']("Eligible for members special gift ?")) : ":Regular item"; ?>
  11. <?php $this->startBlock('body'); ?>
  12. Hello, <?php echo $user; ?>!
  13. <?php if ($isMember): ?>
  14. <?php $finalPrice = $initialPrice - ( $initialPrice * $discount / 100 ); ?>
  15. You have a discount of <?php echo $discount; ?>%, so the final price is <?php echo $finalPrice; ?> EUR.
  16. <?php if ($finalPrice < 100): ?>
  17. You're eligible for free shipping!
  18. <?php else: ?>
  19. Shipping costs will apply.
  20. <?php endif; ?>
  21. <?php else: ?>
  22. No discount applies since you are not a member.
  23. The price remains <?php echo $initialPrice; ?> EUR.
  24. <?php endif; ?>
  25. <?php if ($items > 3): ?>
  26. As you have more than 3 items, you receive an additional 10 bonus points!
  27. <?php $bonusPoints = $bonusPoints + 10; ?>
  28. <?php endif; ?>
  29. Your total bonus points: <?php echo $bonusPoints; ?>.
  30. <?php foreach (range(1,$items) as $i): ?>
  31. - Item <?php echo $i; ?>: <?php echo $isMember ? $__filters['upper']("Eligible for members special gift ?") : ":Regular item"; ?>\n
  32. <?php if ($i == 10): ?>
  33. This is an even-numbered item.
  34. <?php else: ?>
  35. This is an odd-numbered item.
  36. <?php endif; ?>
  37. <?php endforeach; ?>
  38. <?php if ($items == 0): ?>
  39. You have no items in your cart.
  40. <?php elseif ($items == 1): ?>
  41. You have 1 item in your cart.
  42. <?php else: ?>
  43. You have <?php echo $items + 41; ?> items in your cart.
  44. <?php endif; ?>
  45. <?php echo $__functions['dump'] ( $isMember ); ?>
  46. <?php if ($isMember === true): ?>
  47. <?php echo $__filters['lower']($__filters['upper']('okkkkkkkkkkkkkkkk')); ?>
  48. <?php endif; ?>
  49. <?php $this->endBlock(); ?>