Tribiq CMS

Choose your language

6.1 Search Results (Simple) Template

In order for the CMS to process search queries and search result, a Content Item must be created that is assigned a Search template, typically called "HTML-Search.tpl.php". This Search template must either contain the Simple or Advanced snippets to display results.

Simple Method

This will handle the results of a search query using the Tribiq CMS Searchbox Snippet and display them on one page.

Your search box must reference the alias of the search results page (the content item ID or alias which contains this snippet) you wish your user to be presented with.

We must first convert the query request into a variable for ease of use.

Put the following snippet at the top of your template.

<?php
if ($_GET['searchterm']) {
$searchterm = $_GET['searchterm'];
} elseif ($_POST['searchterm']) {
$searchterm = $_POST['searchterm'];
}
?>


To embed the results of a Tribiq CMS search query into a template, use the following snippet and save the file as “HTML-search.tpl.php” and place it within your template family:

<?php
include "templateincludes/search.inc.php";
if ($searchterm) {
    echo "<div id=\"search_results_summary\"><h1>You searched for &quot;" . $searchterm . "&quot;.</h1></div>\n";
    echo "<div id=\"search_results_summary\"><h2>Your search returned " . $total_results . " results:</h2></div><br />\n";
}
echo $output;
?>


A Search results page can be built through the CMS once this template file has been installed through the admin panel. It can be created by creating a HTML Content Item that uses this template.
 

Top of Page