简体   繁体   中英

Making Word Clouds in TWIG with Symfony2

I want to create a Word Cloud (Tag Cloud) in a Symfony2 project on my homepage. I figured it should be done in the TWIG that is rendered for my homepage by passing through to it the array containing my tags and their frequency.

But that's all I know/guess! What should be done next, how to create the css for each tag and how(javascript/html/...) this should be done, I have no idea!

Can anyone help me please?

PS: I am a newbie and haven't got my head around how javascripts work with twigs!

You do not need javascript to show tag cloud in twig. You just have to make as much css classes as many tag styles you want to have and then you have to connect the frequency of the tag with its class.

So it would have to be something like this:

Foreach tag in tags, case/if/elseif/elseif... the frequency and print out proper css style for that very frequency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM