SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    564
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Unhappy How to go with smarty ?

    Hi,

    I am making a very basic shopping cart...and i came to know about smarty. I tried getting help from smarty but there's no response. Anyways i intend to do a basic use of smarty.

    What i want to achieve through smarty ?

    On the main index page i am randomly displaying 9 products from database. I need to display these 9 products in a 3 x 3 grid and following is the code that will be used to generate html...

    Code:
                    <table border="0" width="100%" cellspacing="0" cellpadding="5">
                            <tr>
                                    <td align="center"><img border="0" src="{prodimage}" width="85" height="85"></td>
                            </tr>
                            <tr>
                                    <td align="center">
                                    <span class="smalltext">{category}</span><br>
                                    <span class="bluelink"><a href="add-to-cart.php?id={id}">{productname}</a></span><br>
                                    <span class="price">Price: {csign}{price}</span><br>
                                    <span class="smalltext">{stockstatus}</span>
                                    </td>
                            </tr>
                            <tr>
                                    <td align="center"><img border="0" src="images/add2cart.gif" width="94" height="23"></td>
                            </tr>
                    </table>
    So now using smarty i have to make a 3x3 grid and process the template and show to user...how do i achieve this ?

    Thanks.

  2. #2
    PHP Brainiac dg_den_golotyuk's Avatar
    Join Date
    Jul 2006
    Location
    Kiev, Ukraine
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is very simply archieved by using two section keywords - one inside the other:
    {section name=outer}
    {section name=inner}
    {/section}
    {/section}

    For more info read here:
    http://smarty.php.net/manual/en/lang...on.section.php
    It is really clear
    DG [Den Golotyuk], Lead Developer
    Chestnut Software
    Avoid web outsourcing scams!
    Click here
    for a free downloadable report


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •