Templates Introduction
From Buyitsellit Wiki
Contents |
[edit] Using BISI Markup
BISI Markup is the template engine BuyItSellIt uses for template customization. It is very simple, powerful and easy to understand.
[edit] Variable Output
Here are some simple examples of Variable Output:
Store Title (ie: Joe's CD Shack ) Accessorize Me Cart Count (Items in buyers cart) $CartCount
[edit] Comments
You can add comments to your BISI Markup that will be hidden from display
#* this is an example comment *#
[edit] If / Else
If else is used in any programming language and should be easily recognized. This allows you to write simple expressions in the if.
#(if $CartCount == 0) Hey, There's nothing in your cart! #else You have $CartCount item(s) in your cart! #end
[edit] For loops
allows for loops over collections
<ul>
#foreach($Category in $Categories)
<li><a href="$Category.CategoryLink">$Category.Name</a> ($Category.ProductCount)</li>
#end
</ul>
During every for loop there are following helper variables available for extra styling needs:
#foreach($i in $items)
#each (this is optional since it's the default section)
text which appears for each item
#before
text which appears before each item
#after
text which appears after each item
#between
text which appears between each two items
#odd
text which appears for every other item, including the first
#even
text which appears for every other item, starting with the second
#nodata
Content rendered if $items evaluated to null or empty
#beforeall
text which appears before the loop, only if there are items
matching condition
#afterall
text which appears after the loop, only of there are items
matching condition
#end
So for example you can use it to create a table contents with alternating styles:
#foreach($Product in $Products)
#beforeall
<table>
<tr>
<th>Title</th>
<th>Price</th>
</tr>
#before
<tr
#odd
Style='color:gray'>
#even
Style='color:white'>
#each
<td><a href="$Product.ProductLink">$Product.Title</a></td>
<td>$$Product.Price</td>
#after
</tr>
#between
<tr><td colspan='2'>$Product.ShortDescription</td></tr>
#afterall
</table>
#nodata
Sorry No Products Found
#end
Which will output something like:
<table>
<tr>
<th>Title</th>
<th>Price</th>
</tr>
<tr style='color:white'>
<td>Product Title 1</td>
<td>$5.99</td>
</tr>
<tr><td colspan='2'>Short product description 1 here....</td></tr>
<tr style='color:gray'>
<td>Product Title 2</td>
<td>$8.99</td>
</tr>
<tr><td colspan='2'>Short product description 1 here....</td></tr>
</table>
