Posted By

webjey on 01/12/13


Tagged


Versions (?)

Test


 / Published in: PHP
 

This is just a test

  1. <?php
  2.  
  3. /*
  4.  * BACKEND
  5.  * Populate the value of the required data structure of the template
  6.  */
  7.  
  8. // if provider=pg and number = 0 then the backend should output
  9. [
  10. {
  11. "price":"Not Available",
  12. "discounts": "",
  13. "free_shipping":"",
  14. "buttons":[]
  15. }
  16. ]
  17.  
  18.  
  19. // if provider=pg and number > 0 then the backend should output
  20. [
  21. {
  22. "price":"$1,200",
  23. "discounts": "20% Discounts",
  24. "free_shipping":"Free Shipping",
  25. "buttons":[{'btn_see_it':{'link':'http://google.com'}}]
  26. }
  27. ]
  28.  
  29.  
  30.  
  31. /* FRONTEND
  32.  * The template should have a logic less so we just ouput the price
  33.  *
  34.  */
  35.  
  36. The price is : {{price}}
  37. The discount is : {{discount}}
  38. The shipping is : {{free_shipping}}
  39.  
  40. {{#buttons.btn_see_it}}
  41. {{> btn_see_it}} // found out that mustache has a so called "partials" which acts to include another template
  42. {{/buttons.btn_see_it}}
  43.  
  44. ?>

Report this snippet   <

You need to login to post a comment.