dot-totally.co.uk > Software > WatchRate > Template Tags
WatchRate: Template Tags
WatchRate version 0.11 and upwards support the use of template tags to easily change the design
and how WatchRate outputs the information. In WatchRate version 0.2 and above, the system was moved
to a PHP4 OOP approach, and as such now the template tags begin with $wr->. A template
for WatchRate must follow this order:
$wr = new WatchRate();$wr->start();if ($wr->haveratings()) {- Any out-of-loop template tags
while ($wr->ratingsrow()) {- Any in-loop template tags
}- Any out-of-loop template tags
}
The two default templates provided with the WatchRate installation, view.php and rss.php follow this template guideline.
In-Loop template tags
These tags are ones that should be used within the WatchRate loop:
$wr->gettitle
Prints out the title of the current rating row.
Parameters:
$return- Set the variable to TRUE to simply return the title rather than printing it. (default: false)
$wr->gettype
Prints out either "film" or "episode" depending on type of current rating.
Parameters:
$return- Set the variable to TRUE to return the type rather than printing it. (default: false)$bool- Set the variable to TRUE to change to return/print TRUE if type is film, and FALSE if type is episode. (default: false)
$wr->gettags
Gets the list of tags for the current rating.
Parameters:
$delim- The text to be printed inbetween each tag. (default: ',')$beforetag- The text to be printed before each tag. (default: nothing)$aftertag- The text to be printed after each tag (default: nothing)$inanchor- When TRUE, automatically links tags. Set to FALSE to simply print out text with links. (default: true)$return- Set the variable to TRUE to simply return the tags rather than printing it. (default: false)
$wr->getmorelink
For episode ratings, will give a link to see "more from this show", for films, will link to the IMDB link provided.
Parameters:
$imdbtext- The text to be printed if a link to IMDB (default: 'imdb')
$showtext- The text to be printed if a link to more from this show (default: 'more from this show')$before- The text to be printed before the link (default: ';')$after- The text to be printed after the link (default nothing)$inanchor- When set to TRUE, will create the link. When set to FALSE, it will return the link URI.$return- Set the variable to TRUE to simply return the link rather than printing it. (default: false)
$wr->getrating
Gets the rating of the current film/episode.
Paramaters:
$inimgWhether to place in an <img> tag, linking to the default rating images$return- Whether to print out or return the rating
$wr->getdateadded
Returns the date a rating was added, formatted like the PHP date function (See reference)
Parameters:
$format- The PHP date function formatting, see link above (default: 'U')$return- Set the variable to TRUE to simply return the date instead of printing it. (default: false)
$wr->getadminlinks
Gets the links for editing and deleting the current rating link. Will only display if the admin is logged in.
Parameters:
$before- The text to be printed out before the links (default: '<td>')$after- The text to be printed out after the links (default: '</td>')$editclass- The CSS class to be applied to the edit link (default: 'e')$deleteclass- The CSS class to be applied to the delete link (default: 'x')$return- Set the variable to TRUE to simply return the links instead of printing them (default: false)
Out-of-loop template tags
These template tags can be used anywhere in the page, as long as they are after $wr->start();
$wr->getpoweredmsg
Returns the default 'Powered by WatchRate' message, and if the admin is logged in, a link to the adding page.
Paramaters:
$before- The text to be printed before the message and link (default: '&lt;p class=&quot;nav&quot;&gt;')$after- The text to be printed after the message and link (default: '&lt;/p&gt;')$return- Set the variable to TRUE to simply return the message and link instead of printing them (default: false)
$wr->getrsslink
Gets the link to the current view's RSS feed (i.e. it changes depending on whether you're viewing by a tag, or viewing all)
Paramaters:
$inlink- When set to TRUE, prints out the &lt;link&gt; code for placing straight into the &lt;head&gt; section, on DEFAULT will just print the URI (default: true)$return- Set the variable to TRUE to simply return the RSS link instead of printing it (default: false)
$wr->getpreviouslink
Prints out the link to the previous page of results.
Paramaters:
$inanchor- When set to TRUE, will make the text a link. Otherwise, it will just get the link URI. (default: true)$anchortext- The text for use in the link (default: '&amp;laquo; Previous')$return- Set the variable to TRUE to simply return the link instead of printing it (default: false)
$wr->getnextlink
Prints out the link to the previous page of results.
Paramaters:
$inanchor- When set to TRUE, will make the text a link. Otherwise, it will just get the link URI. (default: true)$anchortext- The text for use in the link (default: 'Next &amp;raquo;')$return- Set the variable to TRUE to simply return the link instead of printing it (default: false)
$wr->getnavlinks
Gets the links for navigation (selecting films, shows, all, etc)
Paramaters:
$before- The text to print out before the links (default: '&lt;p class=&quot;nav&quot;&gt;')$after- The text to print out after the links (default: '&lt;/p&gt;')$delim- The text to print inbetween each link (default: '|')$return- Set the variable to TRUE to simply return the links instead of priting them (default: false)