{init_favorites}

Tag {init_favorites} returns user's favorite objects for the currently logged in user.

Parameters

    • name - variable name where the returned data is saved. Default value is "favorites".
    • classes - defines the object types to display (comma separated list). If not defined then all types will be returned.
    • order - defines how favorites are sorted.

Attributes

    • id - ID number of the object 
    • href - link to the object, e.g. "index.php?id=234"
    • title - title of the object 
    • icon - relative path to the favorite icon file
    • all - array of all object's general data

General tags

    • <name>_count - the number of the returned favorites

Example

{init_favorites name="favorites" classes="section"}
{foreach from=$favorites item=fav}
<a href="{$fav->href}">{$fav->title}</a><br>
{/foreach}

Adding and removing objects from favorites

To add or remove object from the favorites list use parameters op with a value "bookmark" and id with a value of the objects ID, in either a GET or POST query.

Add current page to favorites, GET:

<a href="{$wwwroot}/?op=bookmark&id={$id}">Bookmark this page</a>

Add current page to favorites, POST:

<form method="POST" target={$self}>
<input type="hidden" name="op" value="bookmark">
<input type="hidden" name="id" value="{$id}">
<input type="submit" value="Bookmark this page">
</form>