• 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 Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Simple tag cloud using Search and News
PostPosted: Thu Apr 18, 2019 2:27 am 
Offline
Forum Members
Forum Members
User avatar

Joined: Wed Aug 29, 2007 4:36 am
Posts: 246
Location: Sydney Australia
In News settings I created a text field called Comma_Separated_Tags.

In Design Manager I create a Search Form Template:
\$1:
{$startform}
<input class="button button-3d button-mini button-rounded" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" value="holder" type="submit" />
{if isset($hidden)}{$hidden}{/if}
{$endform}
This uses just the form button to pass a value of "holder" to the search.

Next, in the News Detail Template, I added this code:
\$1:
{$cloudwords = ","|explode:$entry->fieldsbyname.Comma_Separated_Tags->value}
            {foreach from=$cloudwords item=words}
            {Search|replace:"holder":$words search_method="post"}
            {/foreach}
This loops through the array and creates a separate form (each with a unique ID) for each search word/phrase and replaces "holder" with those words from the array.

Then a bit of CSS to make the forms play nice with each other:
\$1:
.cms_form { display: inline-block; }


Now each News Article has a Tag Cloud where each word will do a global search for related content.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Simple tag cloud using Search and News
PostPosted: Thu Apr 18, 2019 3:21 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8166
Location: Fernie British Columbia, Canada
This should do the trick too: Rather than a special form template, and umpteen forms, you just need links.

\$1:
<a href="{cms_action_url module=Search action=dosearch searchinput=$word}">{$word}</a>

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Simple tag cloud using Search and News
PostPosted: Mon May 06, 2019 10:41 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Wed Aug 29, 2007 4:36 am
Posts: 246
Location: Sydney Australia
Thanks CalGuy I'll try that.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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:  
cron
A2 Hosting