Hello,
I've come into trouble in creating tag cloud, if somebody know how to solve it, please help.
I have a gallery with <cms:editable name='genre' type='text' /> , so admins fill this field for each image. For example, for "image1.jpg" they write "green", for "image2.jpg" = "yellow", "image3.jpg" = "grey", and for "image4.jpg" they write "yellow".
So, the code
gives me "green, yellow, grey, yellow," . But I need the result to be "green, yellow, grey" - so the tags shouldn't be doubled. It would be better also if a string that have two or more inclusions (like "yellow" here) will have a custom class.
This task can't be resolved using pre-defined dropdown editable with certain values, because admins should be able to create new tags.
Only thing that I could do is removing doubled strings like that:
So the result is "green, grey"
But have no idea how to render the doubled elements only once and with custom class. If anybody have an idea, please help
I've come into trouble in creating tag cloud, if somebody know how to solve it, please help.
I have a gallery with <cms:editable name='genre' type='text' /> , so admins fill this field for each image. For example, for "image1.jpg" they write "green", for "image2.jpg" = "yellow", "image3.jpg" = "grey", and for "image4.jpg" they write "yellow".
So, the code
- Code: Select all
<cms:pages>
<cms:if genre>
<cms:show genre />,
</cms:if>
</cms:pages>
gives me "green, yellow, grey, yellow," . But I need the result to be "green, yellow, grey" - so the tags shouldn't be doubled. It would be better also if a string that have two or more inclusions (like "yellow" here) will have a custom class.
This task can't be resolved using pre-defined dropdown editable with certain values, because admins should be able to create new tags.
Only thing that I could do is removing doubled strings like that:
- Code: Select all
<cms:pages><cms:if genre>
<cms:php>
preg_match_all( '/\b<cms:show genre />\b/ui', '<cms:pages><cms:show genre /> </cms:pages>', $m);
if(count($m[0]) > 1)echo("");
else echo("<cms:show genre />, ");
</cms:php>
</cms:if></cms:pages>
So the result is "green, grey"
But have no idea how to render the doubled elements only once and with custom class. If anybody have an idea, please help