• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to find all keyword occurencies directly from content
PostPosted: Thu Mar 20, 2014 8:48 am 
Offline
Forum Members
Forum Members
User avatar

Joined: Wed Apr 01, 2009 6:03 pm
Posts: 186
Location: Plzen, CZ
Maybe you sometimes think how to find all keyword occurencies directly from article on your website instead searching with search form. It is useful e.g. for wiki-based sites etc.
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":

\$1:
$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\"}");


What UDT does?
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:
\$1:
If 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.


Searching template
Additionally update your searching template:
\$1:
{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}

(please delete __ before and after "script")
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


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to find all keyword occurencies directly from conten
PostPosted: Thu Mar 20, 2014 1:24 pm 
Offline
Power Poster
Power Poster

Joined: Sat May 05, 2012 7:29 pm
Posts: 404
Location: India
Thx for sharing this - very helpful.

By the way - with Smarty 3 you can make things like this

osxfil \osxfil:
\$1:
{capture assign='term'}{$smarty.get.keyword}{/capture}



a lot shorter ;)

\$1:
{$term = $smarty.get.keyword}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to find all keyword occurencies directly from conten
PostPosted: Thu Mar 20, 2014 2:20 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Wed Apr 01, 2009 6:03 pm
Posts: 186
Location: Plzen, CZ
Yeah, sure. Force of habit ;)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting