Difference between revisions of "Carma list"

From TMM Wiki
Jump to navigationJump to search
Line 3: Line 3:
 
}}
 
}}
  
= carma_list and carma_list_all =
+
= carma_list_videos =
* Purpose: Retrieve actor, location, category or group data for one specific gallery or the whole database
+
* Purpose: Display a list of video galleries on any template.
* Usage: {carma_list list="actors,locations"}
+
* Usage: {carma_list_videos count=20 start=0 section=1}
* Required: list
+
* Required: none
* Optional: galid, var, count, start, siteid, section, active, order, alpha_letters
+
* Optional: count, start, section, order, tpl, easy_keys, data_only, assign_prefix, assign, display_on_assign, actors, locations, categories, groups
* Version: 1.3.0.1 or greater
+
* Default Templates Used: show_videos
* Default Templates Used: none
+
* Variables created: $carma_content, $carma_content_count, $params
* Variables created: $carma_list, $params
 
  
 
== Parameters ==
 
== Parameters ==
Line 23: Line 22:
 
|-
 
|-
 
| [[count]]
 
| [[count]]
| How many of the content do we display per page
+
| Show this many videos
| Zero or any whole number greater than zero
+
| Any whole number greater than zero
| 50
+
| 20 (Shows 20 videos)
| count=$params.count
+
| count=5
 
|-
 
|-
| [[start]]
+
| start
| What number did the content start displaying at
+
| Don't show the videos lower than this number
| Any whole number greater than zero
+
| Any whole number, zero or greater
| ''None.'' (Doesn't hide any results)
+
| 0 (Shows all videos)
| start=$params.start
+
| start=20
 +
|-
 +
| section
 +
| Which section the items belong to
 +
| A comma-delimited list of section I.D.s or a specific section I.D
 +
| None.  Uses the current section.
 +
| section="123"
 +
|-
 +
| order
 +
| what order to sort the videos in
 +
| active, caption
 +
| active
 +
| order="caption"
 
|-
 
|-
 
| [[tpl]]
 
| [[tpl]]
| Template to use for showing the output
+
| Display videos using this template
| Any whole number greater than zero
+
| Any valid template name
| ''None.'' (Doesn't hide any results)
+
| list_videos (Display videos using the list_videos template)
| start=10
+
| tpl="my_template"
 +
|-
 +
| easy_keys
 +
| Use continuous keys instead of keys based on the gallery's I.D. in the $carma_content array.
 +
| 1
 +
| None.  Does not use continuous keys
 +
| easy_keys="1"
 +
|-
 +
| data_only
 +
| Put the videos in an array
 +
| 1
 +
| ''None.'' Displays videos
 +
| data_only=1
 +
|-
 +
| [[assign_prefix]]
 +
| Prefix output variables with this word.  (Click link for details)
 +
| Any valid Smarty variable name
 +
| ''None.'' (No prefix is used)
 +
| assign_prefix="myvar"
 +
|-
 +
| [[assign]]
 +
| Name of the [[Smarty]] variable that stores the output
 +
| Any valid Smarty variable name
 +
| ''None.'' Output is displayed, not stored
 +
| assign="my_var"
 +
|-
 +
| [[display_on_assign]]
 +
| Display videos even when the assign parameter (above) is used
 +
| 1
 +
| ''None'' If assign is used, no videos are displayed
 +
| display_on_assign=1
 +
|-
 +
| actors
 +
| Get information about actors
 +
| 1
 +
| None.  Does not get this information
 +
| actors="1"
 +
|-
 +
| locations
 +
| Get information about locations
 +
| 1
 +
| None.  Does not get this information
 +
| locations="1"
 
|-
 
|-
| [[show_pages]]
+
| categories
| The amount of page numbers to display to the users
+
| Get information about categories
| Any whole number greater than zero
+
| 1
| ''9.'' (Doesn't hide any results)
+
| None. Does not get this information
| show_pages=9
+
| categories="1"
 
|-
 
|-
| [[current_page]]
+
| groups
| The current page that is being shown
+
| Get information about groups
| Any whole number greater than zero
+
| 1
| Will be calculated on the fly
+
| None.  Does not get this information
| current_page=5
+
| groups="1"
 
|-
 
|-
| [[total_pages]]
+
| full_metadata
| Total amount of pages that exist
+
| Put the following information in variables: total length, total size, name, clip_count, files, files size, and files length
| Any whole number greater than zero
+
| 1
| Will be calculated on the fly
+
| None.  Does not store full metadata
| total_pages=65
+
| full_metadata="1"
 
|}
 
|}
 +
 +
== full_metadata Variables ==
 +
By default, the following [[Smarty]] variables are created when you enable the ''full_metadata'' parameter
 +
 +
* {$entry.type_data.wmv.total_length}
 +
* {$entry.type_data.wmv.total_size}
 +
* {$entry.type_data.wmv.name}
 +
* {$entry.type_data.wmv.clip_count}
 +
* {$entry.type_data.wmv.files} an array of clips
 +
* {$entry.type_data.wmv.files_size} an array of clips sizes
 +
* {$entry.type_data.wmv.files_length}
 +
  
 
== Description ==
 
== Description ==
This function retrieves a list of actors, locations, categories or
+
Displays the count video content sets starting at start for the current
groups. By default CARMA retrieves all actors, locations, categories,
+
or a given (set of) section(s). It uses the show_videos template to
and groups stored in the CARMA database. If only want to retrieve a
+
display this information.
list matching a specific gallery, define galid in the call to
 
carma_list. The variables are stored in an array. For example,
 
actors are stored as $carma_list.actor[], categories are stored as
 
$carma_list.category[]. Each item in the array is again an array with
 
each field being one of the fields in the corresponding database table.
 
  
== Example Template ==
+
== Examples ==
<pre>
 
<div class='video_pages'>
 
  <div class='video_pages-big'>PAGE {$params.current_page} OF {$params.total_pages}</div>
 
   
 
  {if $params.current_page > 1 }
 
    <div class='video_pages-big'><a href='{rebuild_link using="GET" without="start,count"}&start=0&count={$params.count}'>&lt;&lt; FIRST</a></div>
 
    <div class='video_pages-big'><a href='{rebuild_link using="GET" without="start,count"}&start={math equation="x-y" x=$params.start y=$params.count}&count={$params.count}'>&lt; PREVIOUS</a></div>
 
  {else}
 
    <div class='video_pages-big'>&lt;&lt; FIRST</div>
 
    <div class='video_pages-big'>&lt; PREVIOUS</div>
 
  {/if}
 
     
 
  {foreach from=$page_numbers item=page_info}
 
    {if $params.current_page == $page_info.page}
 
      <div class='video_pages-active'>{$page_info.page}</div>
 
    {else}
 
      <div class='video_pages-small'><a href='{rebuild_link using="GET" without="start,count"}&start={$page_info.start}&count={$params.count}'>{$page_info.page}</a></div>
 
    {/if}
 
  {/foreach}
 
     
 
  {if $params.current_page < $params.total_pages }
 
    <div class='video_pages-big'><a href='{rebuild_link using="GET" without="start,count"}&start={math equation="x+y+1" x=$params.start y=$params.count}&count={$params.count}'>NEXT &gt;</a></div>
 
    <div class='video_pages-big'><a href='{rebuild_link using="GET" without="start,count"}&start={math equation="(x-1)*y" x=$params.total_pages y=$params.count}&count={$params.count}'>LAST &gt;&gt;</a></div>
 
  {else}
 
    <div class='video_pages-big'>NEXT &gt;</div>
 
    <div class='video_pages-big'>LAST &gt;&gt;</div>
 
  {/if}
 
</div>
 
</pre>
 
  
== Example Function Call ==
+
=== Paging ===
 +
This function has built in paging.  You just need to set start to be the start of output and it will go to 'count'.  On the next call it has to be start+count  and the go backward it would be start-count.  Out default list_videos template takes care of the math for you, but you need to add the start value to the function call like this:
 +
{carma_list_videos count=20 section=1 start=$smarty.request.start }
  
<pre>
+
$smarty.request.start will always contain the page's start value.
{print_page_numbers start=$params.start count=$params.count total=$carma_content_count}
 
</pre>
 

Revision as of 12:33, 8 June 2010

CARMA
  Template Functions
CARMA Template Functions
carma_actor_photo_name
carma_comments_display
carma_comments_form
carma_count
carma_favorite
carma_gal_custom
carma_get_extended
carma_list
carma_list_favorites
carma_list_gals
carma_list_third_party_content
carma_list_videos
carma_login_log
carma_most_viewed
carma_newest
carma_news
carma_poll
carma_retrieve_sections
carma_search
carma_actors_search
carma_show_gal
carma_show_video
carma_top_actors
carma_top_rated
carma_upcoming
print_page_numbers
Template Function Aliases
carma_comment_display
carma_display_comment
carma_display_comments
carma_extended
carma_extended_data
carma_get_extended_data
carma_list_all
Common Parameters
assign
assign_prefix
count
data_only
display_on_assign
start
tpl

carma_list_videos

  • Purpose: Display a list of video galleries on any template.
  • Usage: {carma_list_videos count=20 start=0 section=1}
  • Required: none
  • Optional: count, start, section, order, tpl, easy_keys, data_only, assign_prefix, assign, display_on_assign, actors, locations, categories, groups
  • Default Templates Used: show_videos
  • Variables created: $carma_content, $carma_content_count, $params

Parameters

(Required parameters in bold)

Parameter Description Possible Values Default Value Example
count Show this many videos Any whole number greater than zero 20 (Shows 20 videos) count=5
start Don't show the videos lower than this number Any whole number, zero or greater 0 (Shows all videos) start=20
section Which section the items belong to A comma-delimited list of section I.D.s or a specific section I.D None. Uses the current section. section="123"
order what order to sort the videos in active, caption active order="caption"
tpl Display videos using this template Any valid template name list_videos (Display videos using the list_videos template) tpl="my_template"
easy_keys Use continuous keys instead of keys based on the gallery's I.D. in the $carma_content array. 1 None. Does not use continuous keys easy_keys="1"
data_only Put the videos in an array 1 None. Displays videos data_only=1
assign_prefix Prefix output variables with this word. (Click link for details) Any valid Smarty variable name None. (No prefix is used) assign_prefix="myvar"
assign Name of the Smarty variable that stores the output Any valid Smarty variable name None. Output is displayed, not stored assign="my_var"
display_on_assign Display videos even when the assign parameter (above) is used 1 None If assign is used, no videos are displayed display_on_assign=1
actors Get information about actors 1 None. Does not get this information actors="1"
locations Get information about locations 1 None. Does not get this information locations="1"
categories Get information about categories 1 None. Does not get this information categories="1"
groups Get information about groups 1 None. Does not get this information groups="1"
full_metadata Put the following information in variables: total length, total size, name, clip_count, files, files size, and files length 1 None. Does not store full metadata full_metadata="1"

full_metadata Variables

By default, the following Smarty variables are created when you enable the full_metadata parameter

  • {$entry.type_data.wmv.total_length}
  • {$entry.type_data.wmv.total_size}
  • {$entry.type_data.wmv.name}
  • {$entry.type_data.wmv.clip_count}
  • {$entry.type_data.wmv.files} an array of clips
  • {$entry.type_data.wmv.files_size} an array of clips sizes
  • {$entry.type_data.wmv.files_length}


Description

Displays the count video content sets starting at start for the current or a given (set of) section(s). It uses the show_videos template to display this information.

Examples

Paging

This function has built in paging. You just need to set start to be the start of output and it will go to 'count'. On the next call it has to be start+count and the go backward it would be start-count. Out default list_videos template takes care of the math for you, but you need to add the start value to the function call like this:

{carma_list_videos count=20 section=1 start=$smarty.request.start }

$smarty.request.start will always contain the page's start value.