DotAdmin User Guide
The Search Template
 The Search Page.
dotAdmin's site search feature (/content/search) allows website users to perform full-text searches of your website. It takes two arguments, which can be sent from any other page on the website:
- query
- The text which the user is searching for. This is usually provided as an text field for the user to enter their search into.
<input type="text" name="query" value="Search" />
- show
- The number of search results to display per page in the search results page(s). This must be in integer (whole number) between 2 and 50, and will default to 10 if it is not set in the search form. This value would normally be provided as a hidden field.
<input type="hidden" name="show" value="10" />
The values of the above variables are made available throughout the template:
|
Placeholder
|
Output
|
|
{search_string}
|
The search text which was entered by the user.
|
|
{show}
|
The number of search results to show per page.
|
For example, to show the search box at the top of the search template, the following code may be used:
<form action="/content/search/" method="get">
<input type="hidden" name="show" value="{show}" />
<input type="text" name="query" value="{escaped search_string}" />
<input type="submit" name="submit" value="search">
</form>
A hidden field in the search form will carry the show value from the previous request, and the query value will be displayed in the search box.
First view
The first time the search page is viewed, if no search query has been made, the function will return the {no_search} value to the template. This allows us to create a special message which is only shown to the user when they first visit the search page:
<!--IF {no_search}-->
<p>Enter your search text below and hit "Search":
<!--/IF {no_search}-->
The search page will display the "Enter your search text below..." message when the search page is first viewed.
We could also use this to make our search form send default values for the search_string and show values when it is first viewed:
<form name="searchform" action="/content/search/" method="get">
<!--IF {no_search}-->
<input type="hidden" name="show" value="10" />
<input type="text" name="query" value="Enter Search Here"
onfocus="this.value='';" />
<!--/IF {no_search}-->
<!--ELSE-->
<input type="hidden" name="show" value="{show}" />
<input type="text" name="query" value="{escaped search_string}" />
<!--/ELSE-->
<input type="submit" name="submit" value="search">
</form>
The search will have show value of "10", and also display the "Enter Search Here" message in the search box when the search page is first viewed. On subsequent requests, it will display the values sent from the previous requests
After a search
Once a search has been made, the site search will return one of the following elements:
|
Placeholder
|
Output
|
|
IF {no_result}
|
Displayed if no results were found for this search.
|
|
BLOCK {result_found}
|
Contains the output of a successful search.
|
BLOCK {result_found}
The {result_found} contains all of the output of a successful search; The results themselves are output as BLOCK {search_results}, with links to other pages of results in BLOCK {paging}. A number of other values are also output:
|
Placeholder
|
Output
|
|
{total_results}
|
Total number of results found by this search.
|
|
{results_from}
|
The number of the first search result displayed on the current page.
|
|
{results_to}
|
The number of the last search result displayed on the current page.
|
|
BLOCK {search_results}
|
Repeating block of pages found by this search.
|
|
BLOCK {paging}
|
Contains links to other pages of search results, if results are spread across more than one page.
|
The {total_results}, {results_from} and {results_to} elements can be used to display information about what page of results the user is currently viewing, as shown in the example below:
<p>Results {results_from} to {results_to}
of {total_results}</p>
On the first page of a search which shows five results per-page, the above code might display:
Results 1 to 5 of 22.
BLOCK {search_results}
For each search result on the current results page, the search function will return the following elements to the template:
|
Placeholder
|
Output
|
|
{id}
|
The page id of this result item.
|
|
{title}
|
The page title of this result item.
|
|
{short_description}
|
A short description for this result item.
This placeholder will contain the first 150 characters to the nearest word of one of the following (in order of preference): Meta Description, Tagline / Short Description, or Content
|
|
BLOCK {breadcrumb}
|
Repeating block which creates the breadcrumb trail for this result item.
|
|
{id}
|
The zone id of this part of the breadcrumb trail.
|
|
{title}
|
The zone title of this part of the breadcrumb trail.
|
To produce a Google style listing of results, showing a larger title, followed by regular size descriptive text and smaller breadcrumb trail underneath, we could use the following code:
<!--BLOCK {search_results}-->
<p><a href="/content/{ id }" style="font-size: 110%"><b>
{title}</b></a><br />
<!-- IF {short_description} -->
{short_description}...<br />
<!-- /IF {short_description} -->
<span style="font-size: 90%">
<!--BLOCK {breadcrumb}-->
{title} >
<!--/BLOCK {breadcrumb}-->
{title}</span>
</p>
<!--/BLOCK {search_results}-->
A Google style result listing.
The above example would produce the following output:
dotAdmin V1.1 Released
dotAdmin version 1.1 has been formally released and installed on the webserver today. Over the course of the forthcoming weeks, all dotAdmin client...
Home > Latest News > dotAdmin V1.1 Released
dotAdmin Website Launched
After 2 solid years of software development, we are finally ready to offer our website management software to the public. As part of this move, the...
Home > Latest News > dotAdmin Website Launched
Alternatively, we could place the breadcrumb trail alongside the page title, extend the link onto it and also change the '...' at the end of the short description to read '(continues...)' in smaller text:
<!--BLOCK {search_results}-->
<p>
<a href="/content/{ style="font-size: 110%">
<!--BLOCK {breadcrumb}-->
{title} >
<!--/BLOCK {breadcrumb}--><b>
{title}</b></a>
<!-- IF {short_description} -->
<br />
{short_description}
<span style="font-size: 90%">(continues...)</span>
<!-- /IF {short_description} -->
</p>
<!--/BLOCK {search_results}-->
An alternative result listing style.
The above example would produce the following output:
Home > Latest News >
dotAdmin V1.1 Released
dotAdmin version 1.1 has been formally released and installed on the webserver today. Over the course of the forthcoming weeks, all dotAdmin client
(continues...)
Home > Latest News >
dotAdmin Website Launched
After 2 solid years of software development, we are finally ready to offer our website management software to the public. As part of this move, the
(continues...)
BLOCK {paging}
The paging block contains all of the elements for linking to other pages of results when a search returns more than one page of results. This block only exists if more than one page of results is available:
|
Placeholder
|
Output
|
|
{previous}
|
Inside BLOCK {paging}, numeric ID of the previous page of search results, if a previous page exists.
|
|
{next}
|
Inside BLOCK {paging}, numeric ID of the next page of search results, if there is a subsequent page to link to.
|
|
BLOCK {page_links}
|
Inside BLOCK {paging}, repeatable block containing links to individual search results pages.
|
|
{link}
|
Inside BLOCK {page_links}, numeric ID for each page of search results.
|
|
{current}
|
Inside BLOCK {page_links}, used in a conditional instruction (IF) to format the current page link differently from other repetitions of the block.
|
More details on using the paging block can be found on the page “Paging Navs” elsewhere in this documentation. The code sample below makes good use of paging nav elements:
<!--BLOCK {paging}-->
<p align="center">
<!--IF {previous}-->
<<a href="/content/search/?query={url search_string}
&page={previous}&show={show}"
><b>
<!--/IF {previous}-->
Previous
<!--IF {previous}--></b></a><!--/IF {previous}-->
<!--BLOCK page_links-->
[
<!--IF {current}--><!--/IF {current}-->
<!--ELSE-->
<a href="/content/search/?query={url search_string}
&page={link}&show={show}"><b>
<!--/ELSE-->
{link}
<!--IF {current}--><!--/IF {current}-->
<!--ELSE--></b></a><!--/ELSE-->
]
<!--/BLOCK page_links-->
<!--IF {next}-->
<a href="/content/search/?query={url search_string}
&page={next}&show={show}"
><b>
<!--/IF {next}-->
Next
<!--IF {next}--></b></a>><!--/IF {next}-->
</p>
<!--/BLOCK {paging}-->
<!--/BLOCK {result_found}-->
A common implementation of the search template's paging elements.
On the first results page, this will produce the following output:
Previous [1] [2] [3] [4] [5] Next>
On page 2 of the results, the user would see the following:
<Previous [1] [2] [3] [4] [5] Next>
On the last page of search results, we would see:
<Previous [1] [2] [3] [4] [5] Next
Template Elements
Below is a list of all placeholders used in the Search template:
|
Placeholder
|
Output
|
|
IF {no_search}
|
Displayed if no search has been entered (i.e. the first time the search page is viewed).
|
|
{search_string}
|
The search text which was entered by the user. Can be used in all template BLOCKs
|
|
{show}
|
The number of search results to show per page. Can be used in all template BLOCKs
|
|
IF {no_result}
|
Displayed if no results were found for this search.
|
|
BLOCK {result_found}
|
Contains the output of a successful search.
|
|
{total_results}
|
Inside BLOCK {result_found}, total number of results found by this search.
|
|
{results_from}
|
Inside BLOCK {result_found}, the number of the first search result displayed on the current page.
|
|
{results_to}
|
Inside BLOCK {result_found}, the number of the last search result displayed on the current page.
|
|
BLOCK {search_results}
|
Inside BLOCK {result_found}, repeating block of pages found by this search.
|
|
{id}
|
Inside BLOCK {search_results}, the page id of this result item.
|
|
{title}
|
Inside BLOCK {search_results}, the page title of this result item.
|
|
{short_description}
|
Inside BLOCK {search_results}, a short description for this result item.
This placeholder will contain the first 150 characters to the nearest word of one of the following (in order of preference): Meta Description, Tagline / Short Description, or Content
|
|
BLOCK {breadcrumb}
|
Inside BLOCK {search_results}, repeating block which creates the breadcrumb trail for this result item.
|
|
{id}
|
Inside BLOCK {breadcrumb}, the zone id of this part of the breadcrumb trail.
|
|
{title}
|
Inside BLOCK {breadcrumb}, the zone title of this part of the breadcrumb trail.
|
|
BLOCK {paging}
|
Inside BLOCK {result_found}, contains links to other pages of search results, if results are spread across more than one page.
|
|
{previous}
|
Inside BLOCK {paging}, numeric ID of the previous page of search results, if a previous page exists.
|
|
{next}
|
Inside BLOCK {paging}, numeric ID of the next page of search results, if there is a subsequent page to link to.
|
|
BLOCK {page_links}
|
Inside BLOCK {paging}, repeatable block containing links to individual search results pages.
|
|
{link}
|
Inside BLOCK {page_links}, numeric ID for each page of search results.
|
|
{current}
|
Inside BLOCK {page_links}, used in a conditional instruction (IF) to format the current page link differently from other repetitions of the block.
|
|