I got this idea during releasing website for Holovitalis.de (natural healing). They want to have on their website wiki-based section called Lexikon (created with CGBlog module) with FEU submit of articles. One of customer requirements was possiblity for searching all keyword occurencies accross whole website.
1. UDT
Create UDT called "keyword":
Code: Select all
$contentobj = cms_utils::get_current_content();
$page_title = '';
if (is_object($contentobj))
{
$page_title = cms_htmlentities($contentobj->Name());
}
if ($page_title != "Neuer Artikel") { //$page_title variable change to page title where is your articles FEU submit form
$key = $params['key'];
$link = "suchen"; // page alias for search results
echo("<a href=\"".$link."?keyword=".$key."\">".$key."</a>");
} else
echo("{keyword key=\"Your keyword\"}");
UDT convert your searched keyword to the link to page where you want display search results. Additionally provide that you can add instruction how to use the tag to the page with FEU articles submit form, for example:
Searching templateIf you want in your article to use searching for a keyword in the lexicon, in magazines or in the site content, use this tag: {keyword key="Your keyword"} and replace "Your keyword" with text for searching.
Additionally update your searching template:
Code: Select all
{capture assign='term'}{$smarty.get.keyword}{/capture}
{if $term !=''}
{$startform}
<input type="text" class="search-input" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" size="20" maxlength="50" value="{$term}"/>
{if isset($hidden)}{$hidden}{/if}
{$endform}
{literal}
<__script__ type="text/javascript">
window.onload=function(){
document.forms["cntnt01moduleform_1"].submit();
}
</__script>
{/literal}
{else}
{$startform}
<input type="text" class="search-input" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" size="20" maxlength="50" value="{$searchtext}" {$hogan}/>
{if isset($hidden)}{$hidden}{/if}
{$endform}
{/if}
Search form providing auto-submit in case URL parameter "term" is exists. If is URL param "term" empty or if not exists, standard search from will displayed.
How to use
Using of this feature is very simple. Each allowed backend users (admins, editors…) and FEU users (if you have allowed submiting articles by FEU) can use this tag directly on their text:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel arcu mollis arcu lacinia pulvinar consequat nec libero. {keyword key="Curabitur"} ullamcorper ullamcorper libero sit amet vestibulum. Mauris nulla enim, consequat aliquam rhoncus ut, rutrum vulputate justo. Donec tellus justo, mattis quis laoreet eget, malesuada ut augue. Nam aliquam malesuada sagittis. Morbi ante quam, feugiat sit amet euismod ac, tristique non dui. Quisque at sem leo. In hac habitasse platea dictumst. Donec imperdiet nulla id nulla imperdiet iaculis. Morbi nec erat est, vitae laoreet dui. Morbi lobortis augue eu magna luctus vitae molestie lectus eleifend. Ut est nisl, tincidunt eu tempor in, eleifend<a href="{cms_selflink href='a'}">volutpat</a> augue. Nam aliquet auctor felis ac feugiat. Quisque aliquet purus a felis malesuada fringilla.</p>
Live example: go to http://develop.bocekmedia.net/2013/09/Ferrum-metallicum and click to "Curabitur" keyword