Logo

Raffle Factory Templating Documentation


Introduction


Raffle Factory uses a very powerful templating engine - Smarty v2. This documentation provides a guide to each file and its purpose in the Raffle Factory display system.

What is a template engine? A (web) template engine is software that is designed to process web templates and content information to output web documents. It runs in the context of a template system. It is practically a PHP script that interprets some kind of pseudo HTML pages containing placeholders for specific variable content. In our case most are raffle related.

This is not a Smarty tutorial, but a HTML experienced user should have no issues working with Smarty templates, also the Raffle Factory variables and objects will be explained, reducing the need for any PHP knowledge.

Smarty operators are similar to PHP's. PHP Operators.
Making use of smarty, the raffle engine will provide to the Smarty engine some pre-filled objects and arrays of objects that are relevant to the current page displayed. Also all language constants defined in Raffle Factory can be accessed in the template. We advice against writing hard coded text into the Templates, since this would render the multi language concept useless. If you do not care about the ability to translate your site, then you can do as needed.

Also use the "translate" function which tells smarty to replace a string with the relevant Joomla translation:

  {"COM_RAFFLEFACTORY_SOME_TEXT"|translate}


The default language files are located in [siteroot]language/en-GB/en-GB.com_rafflefactory.ini and [siteroot]/administrator/language/en-GB/en-GB.com_rafflefactory.ini - Use them as a template for translating to other languages.

Template Structure


Pages


Files are located in [siteroot]/components/com_rafflefactory/templates/[template name]/

Main Template File Description
t_raffledetails.tpl Contains the Template for Displaying the Raffle Item Details Page
t_categories.tpl Display of Categories Page (Category Directory)
t_category_tree.tpl Display of Categories Tree Page
t_catselect.tpl Category Selection Page
t_editraffle.tpl This is the Template for the “new raffle” and “edit” page, the $task Smarty Variable Contains the Current Task (newraffle or editraffle)
t_googlemap.tpl Google Map Display
t_googlemap_tool.tpl Google Map Select Coordinates Display
t_showusers.tpl User Search Results Page
t_listraffles.tpl The base template for raffle listing. Here are the listing elements being rendered. Most of the output is done in the corresponding *_cell.tpl
t_reportraffle.tpl Raffle Reporting Page Display
t_rateraffle.tpl Rate Raffle Page Display
t_myuserdetails.tpl User's Profile display
t_userdetails.tpl Display of Other Users Details
t_myraffles.tpl Similar to listraffles, only for "My Raffles"
t_mytickets.tpl Similar to listraffles, only for "My Tickets"
t_mywatchlist.tpl Similar to listraffles, only for "My watchlist"
t_mywontickets.tpl Similar to listraffles, only for "My won tickets"
t_myratings.tpl Display for "My Ratings" page
t_search.tpl Template for the Search Page
t_search_users.tpl Template for the Search Users Page


Elements


Elements Description
Raffle Detail Raffle Detail Elements
Category Category Element
Lists Lists Element
t_header_filter.tpl Search Filters Display
filter_button.tpl My Raffles Page Filter
t_listfooter.tpl Pagination Element
sort_field.tpl Sorting Element


Variables used in all the pages


Variable Description
$cfg Settings for the Whole Extension
$is_logged_in 1 if the user is logged in, 0 otherwise
$option Current Option: com_rbids
$page_title Current Page: Categories
$task Current Task: categories
$template_file Current Template: categories



$auction->get()


Used to call functions from the raffles table, all the returned values will be related to the currently viewed auction.

PHP function Returns
getFavorite()True if the raffle is in the user's watchlist
getUsername()Returns the seller's username
getCatname()Returns the category name
getStartDate_Text()Returns the start date
getEndDate_Text()Returns the end date
getCountdown()Returns the expiration countdown timer
getExpired()True if the raffle is expired
getTags()Returns the tags
getGallery()Returns the image gallery
getThumbnail()Returns the main image thumbnail
getMust_Rate()True if the user can rate
getOwnerRating()Returns the seller's rating
getI_am_winner()True if the user is the winner
getWinner()Returns the winner id
getImages()Returns the Raffle images without the gallery plugin
getImageCount()Returns the number of images
getMessages()Returns the raffle messages


Example:


{if $auction->get('Favorite')} You are Watching this Raffle {/if}


Will output the text on watched raffles.


(!) Documentation based on Raffle Factory version 3.5.0