php - Use twig to show product boxes -


i'm using silex framework combined twig. , i'm creating webshop system. of course, products on website. so, thought easy create small template show individual products this:
enter image description here

my twig created template one:

<div id='product-show' class='product-show'>  {{ name | capitalize }}<br> {{ type | capitalize }}<br>  <img src='img/camerashop24/products/{{ type }}.jpg' style='width: 100%; height: relative; float: left; margin-top: 20px;'>  <div id="prijs-bestel-block" class="prijs-bestel-block">     <table style="margin-top: 5px;">         <tr>             <td width="100">                 <h2 style="font-size: 100%; color: #fd5b03; position: relative; top: 50%; transform: translatey(-50%); float: left; margin-left: 15px; font-weight: normal;">                     &euro; {{ price }}                 </h2>             </td>         <form method="post" style="margin-top: 10px; margin-right: 10px;" action="product/{{ type }}">             <td>                 <input type="submit" value="klik en bestel" style="border: 1px solid grey; height: 40px; background-color: #069cde; margin-right: 0px; width: 120px; color: white; font-size: 100%; float: right;">             </td>         </form>         </tr>     </table> </div> 

but i'm using class called product things product (create, get, update , sort of stuff). , there's function display product. i'd use this:

public function showproduct($type, $name, $price){     return $twig->render('product.twig', [         'price' => $price,         'type' => $type,         'name' => $name,     ]); } 

but of course not work since haven't defined $twig , i'm rendering complete page using twig template. how can these problems fixed?


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -