Navigation

Views

Search
 

Toolbox

Template Functions

From Documentation

Revision as of 16:32, 21 November 2006; view current revision
←Older revision | Newer revision→

68 Classifieds comes with a variety of prebuilt template functions that you can use throughout the script. The following sections help describe the different functions and how to call them.

Contents

Featured Listings Horizontal

Featured listings horizontal calls a function and displays all your featured listings in a horizontal table.

To call this function you would include the following code in any template file you want it to appear.

{feature_listings_horizontal number=8 cols=3 table_attr='width="100%" style="border: 1px solid #000;"' td_attr='valign="middle" align="left"'}

The code above calls a smarty custom plugin that we have created. The file is located at includes/classes/smarty/plugins/function.feature_listings_horizontal.php

  • {feature_listings_horizontal - Tells smarty that you want to call that function file above.
  • number=8 - This tells the function how many ads you want displayed.
  • cols=3 - This is the number of columns you want to display before a new row is started.
  • table_attr - attributes for table tag
  • td_attr - attributes for the td tag

You can also include other parameters:

  • show_price - Y or N and this controls the display of the price.
  • tr_attr - attributes for the tr tag
  • trailpad - value to pad the trailing cells on last row with (if any) The default is a space or  
  • hdir - direction of each row to be rendered. possible values: left (left-to-right), right (right-to-left) the default is right
  • vdir - direction of each column to be rendered. possible values: down (top-to-bottom), up (bottom-to-top) default is down.

For more information on the different parameters you can visit this smarty link: http://smarty.php.net/manual/en/language.function.html.table.php

Featured Listings Vertical

Featured listings vertical calls a function and displays all your featured listings in a vertical table.

To call this function you would include the following code in any template file you want it to appear.

{feature_listings_vertical number=4 table_attr='width="100%"' td_attr='valign="middle" align="center"'}

The code above calls a smarty custom plugin that we have created. The file is located at includes/classes/smarty/plugins/function.feature_listings_vertical.php

  • {feature_listings_vertical - Tells smarty that you want to call that function file above.
  • number=4 - This tells the function how many ads you want displayed.
  • table_attr - attributes for table tag
  • td_attr - attributes for the td tag

You can also include other parameters:

  • show_price - Y or N and this controls the display of the price.
  • tr_attr - attributes for the tr tag
  • trailpad - value to pad the trailing cells on last row with (if any) The default is a space or  
  • vdir - direction of each column to be rendered. possible values: down (top-to-bottom), up (bottom-to-top) default is down.

For more information on the different parameters you can visit this smarty link: http://smarty.php.net/manual/en/language.function.html.table.php

Most Viewed

Most Viewed calls a function and displays your most viewed listings in a table.

To call this function you would include the following code in any template file you want it to appear.

{most_viewed number=8 table_attr='width="100%" style="border: 1px solid #000;"' td_attr='valign="middle" align="left"' img_break="
"}

This function has one different attribute from the featured listings and it is: img_break The img_break defines what happens after the image is shown. In the example above a
or line break is added. This function is also meant to be shown vertically.

New Listings

New Listings calls a function and displays your most viewed listings in a table.

To call this function you would include the following code in any template file you want it to appear.

{new_listings number=8 table_attr='width="100%" style="border: 1px solid #000;"' td_attr='valign="middle" align="left"' img_break="
"}

This function has one attribute different from the featured listings and it is: img_break

The img_break defines what happens after the image is shown. In the example above a
or line break is added. This function is also meant to be shown vertically.


Creating your own plugins

You are free to edit the default plugins or create new ones. These plugins are Smarty specific and you can visit their website for more about creating custom plugins. http://smarty.php.net/manual/en/plugins.php