Difference between revisions of "Print page numbers"
From TMM Wiki
Jump to navigationJump to search (Created page with '{{CARMA1 Manual | show_template_functions_section = true }} = print_page_numbers = * Purpose: Output page number links to content instead of just 'next' and 'previous' links * U…') |
|||
Line 21: | Line 21: | ||
! Default Value | ! Default Value | ||
! Example | ! Example | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| [[count]] | | [[count]] | ||
− | | | + | | How many of the content do we display per page |
| Zero or any whole number greater than zero | | Zero or any whole number greater than zero | ||
| 50 | | 50 | ||
− | | count= | + | | count=$params.count |
|- | |- | ||
| [[start]] | | [[start]] | ||
− | | | + | | What number did the content start displaying at |
+ | | Any whole number greater than zero | ||
+ | | ''None.'' (Doesn't hide any results) | ||
+ | | start=$params.start | ||
+ | |- | ||
+ | | [[tpl]] | ||
+ | | Template to use for showing the output | ||
| 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=10 | | start=10 | ||
|- | |- | ||
− | | | + | | [[show_pages]] |
− | | The | + | | The amount of page numbers to display to the users |
− | | Any | + | | Any whole number greater than zero |
− | | | + | | ''9.'' (Doesn't hide any results) |
− | | | + | | show_pages=9 |
|- | |- | ||
− | | | + | | [[current_page]] |
− | | The | + | | The current page that is being shown |
− | | | + | | Any whole number greater than zero |
− | | | + | | Will be calculated on the fly |
− | | | + | | current_page=5 |
|- | |- | ||
− | | | + | | [[total_pages]] |
− | | | + | | Total amount of pages that exist |
− | + | | Any whole number greater than zero | |
− | + | | Will be calculated on the fly | |
− | + | | total_pages=65 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | Any | ||
− | | | ||
− | | | ||
|} | |} | ||
Line 93: | Line 69: | ||
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 == | + | == Example Template == |
<pre> | <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}'><< 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}'>< PREVIOUS</a></div> | ||
+ | {else} | ||
+ | <div class='video_pages-big'><< FIRST</div> | ||
+ | <div class='video_pages-big'>< 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 ></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 >></a></div> | ||
+ | {else} | ||
+ | <div class='video_pages-big'>NEXT ></div> | ||
+ | <div class='video_pages-big'>LAST >></div> | ||
+ | {/if} | ||
+ | </div> | ||
+ | </pre> | ||
− | + | == Example Function Call == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <pre> | |
− | + | {print_page_numbers start=$params.start count=$params.count total=$carma_content_count} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> |
Revision as of 11:33, 8 June 2010
print_page_numbers
- Purpose: Output page number links to content instead of just 'next' and 'previous' links
- Usage: {carma_list list="actors,locations"}
- Required: list
- Optional: galid, var, count, start, siteid, section, active, order, alpha_letters
- Version: 1.4 or greater
- Default Templates Used: page_numbers
- Variables created: $first_page, $last_page, $current_page, $total_pages, $page_params
Parameters
(Required parameters in bold)
Parameter | Description | Possible Values | Default Value | Example |
---|---|---|---|---|
count | How many of the content do we display per page | Zero or any whole number greater than zero | 50 | count=$params.count |
start | What number did the content start displaying at | Any whole number greater than zero | None. (Doesn't hide any results) | start=$params.start |
tpl | Template to use for showing the output | Any whole number greater than zero | None. (Doesn't hide any results) | start=10 |
show_pages | The amount of page numbers to display to the users | Any whole number greater than zero | 9. (Doesn't hide any results) | show_pages=9 |
current_page | The current page that is being shown | Any whole number greater than zero | Will be calculated on the fly | current_page=5 |
total_pages | Total amount of pages that exist | Any whole number greater than zero | Will be calculated on the fly | total_pages=65 |
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 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 Template
<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}'><< 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}'>< PREVIOUS</a></div> {else} <div class='video_pages-big'><< FIRST</div> <div class='video_pages-big'>< 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 ></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 >></a></div> {else} <div class='video_pages-big'>NEXT ></div> <div class='video_pages-big'>LAST >></div> {/if} </div>
Example Function Call
{print_page_numbers start=$params.start count=$params.count total=$carma_content_count}