====== Smarty Variables Available ====== Within any smarty template variables are available you can use to do your own custom dynamic smarty changes. Some variables are available in any page and so can be consistently used in any page/template of the design. But other variables only exist in specific pages because they are only needed within that page. The easiest way to find out what variables are available in a specific page is through use of the {debug} tag. Placing that tag into a smarty template will force a popup to appear when that template is used on the client side. Within that popup are all the variables available in that page for use. There is [[designers:debug_smarty_tag|more about the debug tag use within this support wiki article]]. Below is a mention of the most commonly needed variables. Below we mention those for some general pages and category browsing. Within any specific page there are numerous other variables available but they may only be available within that page. If you try to "smarty code" for a specific page do not expect that code to work in another page in the system. It may be best to create a specific page template for the page you are coding for and assign it to that page. That will allow you to code for a specific page yet not have that code affect other pages in the system. ====== Variables Available in All Pages ====== ^ Tag to Use ^ Example Data ^ Description ^ | {$classifieds_url} | http://example.com/index.php | Lead file of the software | | {$language_id} | 1 (default language) (integer only) | language id of the currently selected language to browse site by | | {$logged_in} | 0 or 1 | if the current browsing client is logged into the system this will be "1". It is "0" otherwise | | {$user} | Array that contains user data | If logged in will contain information about the logged in user. see other section in this page for more | | {$geographic_navigation_region} | integer | Id of the current region set to filter listings by. This is only available within the page if the geographic navigation addon is enabled and a region selected. | | {$body_vars} | array of various data | This is an array of variables that are specific to the current page in the system browsed. This will be different for every page in the system. Since this is different for each page in the system there is no "page to page" consistent use of values in this array. So while it may have a lot of data you can only create "page specific dynamic code" when using it. Basically if making page template changes based on this data the page template would only be useful in the It does not appear at all within the front page. ====== User Data Available On All Pages If User Logged In ====== This data is available on any page when the current browsing user is logged in. ^ Tag to Use ^ Example Data ^ Description ^ | {$user.id} | integer | ID of the user in the system. Note this will be "1" if the master admin user | | {$user.username} | alphanumeric text | username of currently client | | {$user.is_mobile} | true or false | Is true if user connecting from a mobile device. False if not | | {$user.is_tablet} | true or false | Is true if user connecting from a tablet device. False if not | | {$user.email} | email address | Email address of the user currently logged in | | {$user.firstname} | alphanumeric | Value in first name field of user details | | {$user.lastname} | alphanumeric | Value in last name field of user details | | {$user.*} | different types | There are many more pieces of data available from the user. Basically any "registration data" is available. Place the debug variable to see them all | As stated in the last variable much more is available. Just place the debug tag to find out what that is. ====== Data Available in Category Browsing Pages ====== These variables would be available within any page of the category browsing feature. That is any category browsing page. ^ Tag to Use ^ Example Data ^ Description ^ | {$category_id} | integer only | id of current category browsed | | {$currentCategoryName} | alphanumeric | Name of the current category browsed | | {$currentCategoryDescription} | alphanumeric | Description of the current category browsed if one was inserted | | {$parent_categories} | Associative Array of parent category id's | Each element in the array is a parent category id. First value is main category and each successive value is the subcategory selected until you get to the current category. No way to reference directly. Use a smarty for/while to traverse the values. Will be empty (no array values to count) if currently in a main category | ====== Search Results Page ====== ^ Tag to Use ^ Example Data ^ Description ^ | {$body_vars.total_search_results} | integer | total number of listings found given the search criteria passed into the search feature | | {$smarty.get.b.search_text} | aphanumeric | search term inserted into the search text field |