CMS Made Simple Forums

Simple tag cloud using Search and News
Page 1 of 1

Author:  Simon66 [ Thu Apr 18, 2019 2:27 am ]
Post subject:  Simple tag cloud using Search and News

In News settings I created a text field called Comma_Separated_Tags.

In Design Manager I create a Search Form Template:
<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}
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:
{$cloudwords = ","|explode:$entry->fieldsbyname.Comma_Separated_Tags->value}
            {foreach from=$cloudwords item=words}
            {Search|replace:"holder":$words search_method="post"}
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:
.cms_form { display: inline-block; }

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

Author:  calguy1000 [ Thu Apr 18, 2019 3:21 am ]
Post subject:  Re: Simple tag cloud using Search and News

This should do the trick too: Rather than a special form template, and umpteen forms, you just need links.

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

Author:  Simon66 [ Mon May 06, 2019 10:41 pm ]
Post subject:  Re: Simple tag cloud using Search and News

Thanks CalGuy I'll try that.

Author:  jakubr [ Mon Nov 25, 2019 1:41 pm ]
Post subject:  Re: Simple tag cloud using Search and News

I've tried original @Simon66 and also modified @calguy1000 solutions. List of "buttons" with tags or just links works perfectly, but there is a weird problem with search results - links in results points to some nonexistent page in admin panel, for example:


Don't know what is the cause of this problem. I've tested ordinary search form (input field + button), and it gives results with correct links.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group