Difference between revisions of "Carma list"

From TMM Wiki
Jump to navigationJump to search
 
(3 intermediate revisions by 2 users not shown)
Line 21: Line 21:
 
! Default Value
 
! Default Value
 
! Example
 
! Example
 +
|-
 +
| '''list'''
 +
| '''Defines what type of data you want carma_list to return.'''
 +
| '''actors, locations, categories, groups, producers, orientation, type, quality, gender, race, hair, pubic, tits, dick, or body'''
 +
| '''None.'''
 +
| '''list="actors"'''
 +
|-
 +
| galid
 +
| Only get the matching list for this gallery
 +
| Any valid gallery I.D. number
 +
| None.
 +
| galid="123"
 
|-
 
|-
 
| [[count]]
 
| [[count]]
| How many of the content do we display per page
+
| Maximum number of results to display (Click link for details)
 
| Zero or any whole number greater than zero
 
| Zero or any whole number greater than zero
 
| 50
 
| 50
| count=$params.count
+
| count=20
 
|-
 
|-
 
| [[start]]
 
| [[start]]
| What number did the content start displaying at
+
| Hide all results lower than this number (Click link for details)
 
| Any whole number greater than zero
 
| Any whole number greater than zero
 
| ''None.'' (Doesn't hide any results)
 
| ''None.'' (Doesn't hide any results)
| start=$params.start
+
| start=10
 +
|-
 +
| siteid
 +
| The site the items belong to
 +
| Any valid site I.D. number
 +
| None.
 +
| siteid="123"
 
|-
 
|-
| [[tpl]]
+
| section
| Template to use for showing the output
+
| The section to get items from
| Any whole number greater than zero
+
| A comma-delimited list of section I.D.s or a specific section I.Ds.
| ''None.'' (Doesn't hide any results)
+
| None.
| start=10
+
| section="123"
 +
|-
 +
| active
 +
| Limit the search to active content (requires siteid and section variables to be set)
 +
| 1
 +
| None. (Does not limit to active content.)
 +
| active="1"
 
|-
 
|-
| [[show_pages]]
+
| order
| The amount of page numbers to display to the users
+
| Which order to sort the gals in
| Any whole number greater than zero
+
| active, caption, name
| ''9.'' (Doesn't hide any results)
+
| name
| show_pages=9
+
| order="active"
 
|-
 
|-
| [[current_page]]
+
| alpha_letters
| The current page that is being shown
+
| Only grab the list starting with these letters
| Any whole number greater than zero
+
| A comma-delimited list of letters
| Will be calculated on the fly
+
| None.
| current_page=5
+
| alpha_letters="A,B,C"
 
|-
 
|-
| [[total_pages]]
+
| var
| Total amount of pages that exist
+
| The Smarty variable to assign data too
| Any whole number greater than zero
+
| Any valid Smarty variable
| Will be calculated on the fly
+
| carma_list
| total_pages=65
+
| var="my_variable"
 
|}
 
|}
  
Line 62: Line 86:
 
This function retrieves a list of actors, locations, categories or
 
This function retrieves a list of actors, locations, categories or
 
groups. By default CARMA retrieves all actors, locations, categories,
 
groups. By default CARMA retrieves all actors, locations, categories,
and groups stored in the CARMA database. If only want to retrieve a
+
and groups stored in the CARMA database. If you only want to retrieve a
 
list matching a specific gallery, define galid in the call to
 
list matching a specific gallery, define galid in the call to
 
carma_list. The variables are stored in an array. For example,
 
carma_list. The variables are stored in an array. For example,
Line 69: Line 93:
 
each field being one of the fields in the corresponding database table.
 
each field being one of the fields in the corresponding database table.
  
== Example Template ==
+
== Example ==
 
<pre>
 
<pre>
<div class='video_pages'>
+
{carma_list siteid=$siteid count=500 order="name ASC" list="actors,locations,groups,categories" }
  <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 ==
+
<form method="get" action="index.php">
 +
<input type="hidden" name="section" value="{$secid}">
 +
Actor: <select size="5" name="actor">
 +
        {foreach from=$carma_list.actor item=actor}
 +
          <option value="{$actor.actorid}">{$actor.name}</option>
 +
        {/foreach}
 +
      </select> <br>
 +
Category: <select size="5" name="category">
 +
            {foreach from=$carma_list.category item=category}
 +
              <option value="{$category.catid}">{$category.name}</option>
 +
            {/foreach}
 +
          </select> <br>
  
<pre>
+
Group: <select size="5" name="group">
{print_page_numbers start=$params.start count=$params.count total=$carma_content_count}
+
            {foreach from=$carma_list.group item=group}
 +
              <option value="{$group.gid}">{$group.name}</option>
 +
            {/foreach}
 +
          </select> <br>
 +
       
 +
Location: <select size="5" name="location">
 +
            {foreach from=$carma_list.location item=location}
 +
              <option value="{$location.locid}">{$location.name}</option>
 +
            {/foreach}
 +
          </select> <br>
 +
<input type="submit" name="searching" value="Search">
 
</pre>
 
</pre>

Latest revision as of 10:25, 26 July 2011

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 and carma_list_all

  • Purpose: Retrieve actor, location, category or group data for one specific gallery or the whole database
  • Usage: {carma_list list="actors,locations"}
  • Required: list
  • Optional: galid, var, count, start, siteid, section, active, order, alpha_letters
  • Version: 1.3.0.1 or greater
  • Default Templates Used: none
  • Variables created: $carma_list, $params

Parameters

(Required parameters in bold)

Parameter Description Possible Values Default Value Example
list Defines what type of data you want carma_list to return. actors, locations, categories, groups, producers, orientation, type, quality, gender, race, hair, pubic, tits, dick, or body None. list="actors"
galid Only get the matching list for this gallery Any valid gallery I.D. number None. galid="123"
count Maximum number of results to display (Click link for details) Zero or any whole number greater than zero 50 count=20
start Hide all results lower than this number (Click link for details) Any whole number greater than zero None. (Doesn't hide any results) start=10
siteid The site the items belong to Any valid site I.D. number None. siteid="123"
section The section to get items from A comma-delimited list of section I.D.s or a specific section I.Ds. None. section="123"
active Limit the search to active content (requires siteid and section variables to be set) 1 None. (Does not limit to active content.) active="1"
order Which order to sort the gals in active, caption, name name order="active"
alpha_letters Only grab the list starting with these letters A comma-delimited list of letters None. alpha_letters="A,B,C"
var The Smarty variable to assign data too Any valid Smarty variable carma_list var="my_variable"

Description

This function retrieves a list of actors, locations, categories or groups. By default CARMA retrieves all actors, locations, categories, and groups stored in the CARMA database. If you only want to retrieve a 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

{carma_list siteid=$siteid count=500 order="name ASC" list="actors,locations,groups,categories" }

<form method="get" action="index.php">
<input type="hidden" name="section" value="{$secid}">
Actor: <select size="5" name="actor">
        {foreach from=$carma_list.actor item=actor}
          <option value="{$actor.actorid}">{$actor.name}</option>
        {/foreach}
       </select> <br>
Category: <select size="5" name="category">
            {foreach from=$carma_list.category item=category}
              <option value="{$category.catid}">{$category.name}</option>
            {/foreach}
          </select> <br>

Group: <select size="5" name="group">
            {foreach from=$carma_list.group item=group}
              <option value="{$group.gid}">{$group.name}</option>
            {/foreach}
          </select> <br>
         
Location: <select size="5" name="location">
            {foreach from=$carma_list.location item=location}
              <option value="{$location.locid}">{$location.name}</option>
            {/foreach}
          </select> <br>
<input type="submit" name="searching" value="Search">