Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi all, have a question
have a blog with posts:

Code: Select all
<cms:template title='Blog' clonable='1'>
<cms:editable name='tags' type='text' />
</cms:template>


all tags are with separator = ', '

post1 tags: travel, weather, city
post2 tags: cars, tech, road
post3 tags: sun, sea, travel

how to get only unique tags?

i have started, but don't know, how to get only unique using CouchCMS programming tags without php
Code: Select all
<cms:pages masterpage='blog.php'>
   <cms:each tags sep=', '>
      <cms:each item>
         <cms:show item />
      </cms:each>
   </cms:each>
</cms:pages>


in output i need to get just:
travel, weather, city, cars, tech, road, sun, sea

without "travel" dublicates, only 1 time
In the given circumstances, multi-value variables will help, as they behave like regular arrays (values can be unique)..
Otherwise, it is best to have a separate clonable template with relation for the tags. Will be very helpful in later stages of development, it will be possible to list posts that have a certain tag and have tag in pretty-url.
As @trendoman suggested, the recommended practice would be to utilize relations to create the tags.
Please see the following for a detailed example -
viewtopic.php?f=8&t=8952

Hope it helps.
3 posts Page 1 of 1