Member Favorites

From TMMwiki
Jump to: navigation, search
CARMA
Templates Admin
Members Area Templates
Tour Templates
Member Favorites
Smarty Loops
Smarty Caching
Smarty print array
Base Templates
User Variables
Rating System

As of CARMA 1.3.1.0, members can use template functions which let them mark favorites in your site(s). These favorites can be videos, photos, actors, or custom tags.

The two template functions that allow members to mark favorites are carma_favorite and carma_list_favorites. These functions can only be used in CARMA 1.3.1.0 or higher; if you cannot access these templates, please submit an upgrade ticket for your CARMA install.

Add/Removing Favorites

The carma_favorite template function allows members to mark content as a favorite, outputting a link that allows them to either add or delete the selected content to/from their favorites. This function uses the favorite template for its output by default.

Examples

For favorite videos and photos:

{carma_favorite galid=$galid}
{carma_favorite galid=$smarty.request.galid}
{carma_favorite galid=42}

For favorite actor:

{carma_favorite actorid=11}

To create a custom favorite:

{carma_favorite section_name=”fav_type” caption=”title” data=”anything you want here”}

The section_name and caption fields are required in order to use custom favorites. The data field can be set to any Smarty variable.

For example: if you want to bookmark a page, you can set the data field to that page's URL and set caption to the page's title. The value for section_name differs for each group of favorites you're tracking. For example, you can have separate sections for clips and for photos, allowing you to track each member's favorite clips separately from their favorite photos.

To bookmark the current page:

{capture name=link}
http://{$smarty.server.HTTP_HOST}{rebuild_link encode=1}
{/capture}
{carma_favorite section_name='clips' caption=$filename data=$smarty.capture.link}

You can also use the sample code above to create a list of all video clips a member has saved to favorites, instead of making the entire video set a favorite list.

Listing Favorites

The carma_list_favorites function allows you to display a chosen member's favorite content. You can use this function to output all content set to favorites by the member, or to output only a single favorite type (for example, videos, photos, etc). The output of this folder is controlled by the template list by default.

Examples

To output all member's favorites:

{carma_list_favorites}

To output all content favorites (video and photo sets):

{carma_list_favorites get='gals'}

To output all photo set favorites:

{carma_list_favorites get='gals' type='gal'}

To output all video set favorites:

{carma_list_favorites get='gals' type='video'}

To output all actor favorites:

{carma_list_favorites get='actors'}

To output all custom favorites:

{carma_list_favorites get='custom'}

To output all custom favorites with section tag of clips:

{carma_list_favorites get='custom' section_name='clips'}


See Also

For more information on the available parameters for these two template functions, please refer to the following articles: