Page 1 of 1

Lise - how to use tag field?

Posted: Sun Oct 18, 2015 6:03 pm
by frankmanl
I set up LISE and want to use a field of type Tags.
I can enter any tag I like, but how to go on from here?
Actually I expected a tag cloud that displays all and any tags that are used, and clicking a tag getting a list of all items associated to that tag.
Or should the tag field be used in a different way?

Frank

Re: Lise - how to use tag field?

Posted: Sun Oct 18, 2015 6:12 pm
by Jo Morg
Yeah , not all is well documented yet... lack of time...
{LISE<instancename> action=tagcloud} should do what you want. The templates used are from search group so template_search='templatename' should be used as a parameter. IIRC there is a sample template: TagCloud.
HTH

Re: Lise - how to use tag field?

Posted: Mon Oct 19, 2015 3:35 am
by frankmanl

Code: Select all

{LISEactueel action="tagcloud"}
results in a searchbox:
lise.jpg
lise.jpg (10.36 KiB) Viewed 2130 times
which, btw, does not react to terms I enter in it.
There is no sample template TagCloud.
If I can get this to work I'd be more than happy to write the missing documentation for the module.

Re: Lise - how to use tag field?

Posted: Mon Oct 19, 2015 11:53 am
by Jo Morg
frankmanl wrote:There is no sample template TagCloud.
Apparently I forgot to include a sample template with the installation. Will add one to the next release.
Create a new search template:

Code: Select all

{$foo=ksort($tags)}
{foreach $tags as $k => $v}
 <a href="{$v}">{$k}</a>
{foreachelse}
{/foreach}
And call it like: {LISEactueel action=tagcloud template_search='templatename'} that should give you a good starting base.
frankmanl wrote:If I can get this to work I'd be more than happy to write the missing documentation for the module.
:)

Re: Lise - how to use tag field?

Posted: Tue Oct 20, 2015 4:07 am
by frankmanl
This is a good start, Jo Morg.
Still got a couple of issues:

Code: Select all

Syntax error (...) on line 4 "{$foo=ksort($tags)}" PHP function 'ksort' not allowed by security setting
I solved this by using {$foo=sort($tags)}.

Tags are (I suppose) displayed by their position in the array: 0 1 2 3 etc., not alphabetically.
The tagword itself is not shown.
lise.jpg
lise.jpg (9.03 KiB) Viewed 2078 times
I've got a tagword EU and another nieuws. As you can see 'EU' is also part of nieuws.
Now when I click the link for tagword EU (on my testpage that would be link 0, all items of tag EU are returned, but also all items of tag nieuws.

I'll see if I can solve these items, but if you've got suggestions, please let me know.

Re: Lise - how to use tag field?

Posted: Tue Oct 20, 2015 1:00 pm
by Jo Morg
frankmanl wrote:I solved this by using {$foo=sort($tags)}.

Tags are (I suppose) displayed by their position in the array: 0 1 2 3 etc., not alphabetically.
Well, no. {$foo=sort($tags)} won't have the expected effect as $tags are naturally sorted by the order they are found when processing them. Quite the opposite: when using it on an associative array it "(...) assigns new keys to the elements in array. It will remove any existing keys that may have been assigned, rather than just reordering the keys*" and that's why you are getting that (odd) result.

Either remove {$foo=sort($tags)} completely, or replace it by the original {$foo=ksort($tags)} and add $config['permissive_smarty'] = 1; to the config.php file.
Note that this particular template was only tested on CMSMS 1.12, not on 2.0+, after I added the ksort to it.
I will probably add a parameter to the tag to do that in the action itself instead and remove the use the ksort on template on the next release.

* from PHP manual

Re: Lise - how to use tag field?

Posted: Tue Oct 20, 2015 5:48 pm
by frankmanl
replace {$foo=sort($tags)} by the original {$foo=ksort($tags)} and add $config['permissive_smarty'] = 1; to the config.php file
Thanks a lot, this solved it all, the tags are alright now.

Frank