Carma search
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
Parameter
- search_type: possible values are:
- combined: use both settings in input variables and settings from the search[] querystring 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.
- content_type: any/gal/video (Default: any)
- count: How many items to display. (Default: 20)
- start: Which item to start at. (Default: 0)
- split_keywords: If set to 1, the words in keywords will be search individually. If set to 0 (the default) the value of keywords is searched as a phrase.
- order: What order to return the search results. Exact entry used in query. (Examples: cms_gals.galid, cms_gals_info.quality)
- dupe: Set to 1 if you do not want duplicates of a set if published in multiple sections
- any_site: Set to 1 to not limit the search to the current site.
- inactive: Set to 1 to not limit the search to active content.
- tpl: Specify another template to use instead of the default template for this function.
- data_only: Set to 1 if you want to only store the data for later use. (Default: 0/false)
- assign_prefix: String to use in front of created variables for their names, including assign below.
- assign: String to use for a variable that holds the output of the function. Leave blank to not store the output.
- display_on_assign: Set to 1 if you want to still display the template when using assign.
- actors, locations, categories, groups: Set any of these to 1 to make CARMA fetch the respective information for each gallery.
Search Variables
- category, location, group, actor, not_category, not_location, not_group, not_actor: List of comma seperated ids
- orientation, race, hair, tits, pubic, body, setid, not_orientation, not_race, not_hair, not_tits, not_pubic, not_body: List of comma seperated names
- quality, type, gender, age_min, age_max, not_quality, not_type, not_gender: Name of the criteria
- title, caption: 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 inbetween those two. You can choose to hardcode the search query to use or to let the surfer do the search themself.
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 adn 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}