Difference between revisions of "Carma search"
(3 intermediate revisions by one other user not shown) | |||
Line 75: | Line 75: | ||
| None. Fetches all sections for this site | | None. Fetches all sections for this site | ||
| section="1,5,6,8" | | section="1,5,6,8" | ||
+ | |- | ||
+ | | setid | ||
+ | | Limit the search to that Set ID only | ||
+ | | Any valid Set ID | ||
+ | | None. | ||
+ | | setid="1" | ||
|- | |- | ||
| inactive | | inactive | ||
Line 156: | Line 162: | ||
== Notes == | == Notes == | ||
+ | * If you are using the rotating publish mode, you MUST NOT specify inactive, and MUST specify section in your carma_search function calls to get the correct results. | ||
The following options are valid arguments to the <tt>search_type</tt> parameter. | The following options are valid arguments to the <tt>search_type</tt> parameter. | ||
* combined: use both settings in input variables and settings from the search[] query string variable. | * combined: use both settings in input variables and settings from the search[] query string variable. |
Latest revision as of 08:55, 4 August 2011
carma_search
- Purpose: Search for matching galleries and display them if wanted.
- Usage: {carma_search} or {carma_search age_min=18 age_max=19 not_type=Softcore}
- Required: none
- Optional: search_type, content_type, any_site, inactive, q, tpl, data_only, assign_prefix, assign, display_on_assign, actors, locations, categories, groups, count, start, dupe, order, split_keywords
- Search Options: title, description, keywords, setid, category, location, group, type, orientation, quality, actor, gender, age_min, age_max, race, hair, pubic, tits, body, not_category, not_location, not_group, not_type, not_orientation, not_quality, not_actor, not_gender, not_race, not_hair, not_pubic, not_tits, not_body
- Default Templates Used: search_results
- Variables created: $carma_search_results, $carma_search_results_count, $params
Parameters
(Required parameters in bold)
Parameter | Description | Possible Values | Default Value | Example |
---|---|---|---|---|
search_type | How to search | combined, func, default (see Notes section below for details) | default | search_type="func" |
content_type | The type of content to retrieve | any, gal, video | any | content_type="gal" |
count | Show this many comments | Any whole number greater than zero | 20 (Shows 5 comments) | count="5" |
start | Don't show the comments lower than this number | Any whole number, zero or greater | 0 (Shows all comments) | start=20 |
split_keywords | The words in keywords will be searched individually | 1 | None. Keywords are searched as a phrase | split_keywords="1" |
order | What order to return the search results | Exact entry used in query | None. | order="cms_gals.galid" |
dupe | Don't get duplicates of a set | 1 | None. Gets duplicates | dupe="1" |
any_site | Do not limit the search to the current site | 1 | None. Limits the search to the current site | any_site="1" |
section | Limit the search to a list of sections | comma separated list | None. Fetches all sections for this site | section="1,5,6,8" |
setid | Limit the search to that Set ID only | Any valid Set ID | None. | setid="1" |
inactive | Do not limit the search to active content | 1 | None. Limits the search to active content | inactive="1" |
tpl | Display comments using this template | Any valid template name | comments_display (Display comments using the comments_display template) | tpl="my_template" |
data_only | Put the comments in an array | 1 | None. Displays comments | 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 comments even when the assign parameter (above) is used | 1 | None If assign is used, no comments 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" |
producers | Get information about producers | 1 | None. Does not get this information | producers="1" |
Search Variables
- category, location, group, actor, producer, not_category, not_location, not_group, not_actor, not_producer: List of comma separated ids
- orientation, race, hair, tits, pubic, body, setid, not_orientation, not_race, not_hair, not_tits, not_pubic, not_body: List of comma separated names
- quality, type, gender, age_min, age_max, not_quality, not_type, not_gender: Name of the criteria
- title, description: Any text string
Description
This function is used to trigger a search through the content available. You can choose if it searches only for content currently active on the current site, any content in CARMA or something in between those two. You can choose to hard code the search query to use or to let the surfer make their own search.
Notes
- If you are using the rotating publish mode, you MUST NOT specify inactive, and MUST specify section in your carma_search function calls to get the correct results.
The following options are valid arguments to the search_type parameter.
- combined: use both settings in input variables and settings from the search[] query string variable.
- func: use only settings in the input variables.
- default: if neither of the two search_types above are specified CARMA will use the search[] query string variable if found, if not it will use any input variables it can find.
Examples
Example 1
If you list_videos template and wanted to also show a photo set that had the same set id, you could use carma search this way inside the {foreach} ... {/foreach} statements:
{carma_search setid=$entry.setid content_type='gal' data_only=1}
Now you can use the variable $carma_search_results to output your photo set.
Example 2
You can also use carma_search to allow users to search for specific content. Below is a very basic dynamic search form using both carma_search and carma_list. This example can be expanded to use any combination of the above search options.
{assign var="count" value=20} {if $smarty.request.start } {assign var="start" value=$smarty.request.start} {else} {assign var="start" value=0} {/if} {math assign="previous" equation="x - y" x=$start y=$count} {math assign="next" equation="x + y" x=$start y=$count} {carma_list siteid=$siteid count=500 list="actors" order="name ASC"} <h3>Advance Search</h3> <form method="get" action="index.php"> <input type="hidden" name="section" value="{$secid}"> Title: <input type="text" name="title" value="{$smarty.request.title}"><br> Description: <input type="text" name="description" value="{$smarty.request.description}"><br> Keywords: <input type="text" name="keywords" value="{$smarty.request.keywords}"><br> <input type="submit" name="searching" value="Search"> </form> {if $smarty.request.searching} {carma_search count=$count start=$smarty.request.start title=$smarty.request.title description=$smarty.request.description keywords=$smarty.request.keywords} {/if} {if $previous >= 0 } <a href="{rebuild_link without="start" using="GET" start=$smarty.server.HTTP_HOST}&start={$previous}">Previous</a> {else} Previous {/if} {if $next <= $carma_search_results_count} <a href="{rebuild_link without="start" using="GET" start=$smarty.server.HTTP_HOST}&start={$next}">Next</a> {else} Next {/if}