Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hi everyone, I need to duplicate "Stars" in a "repeatable" section.
The code to duplicate is <i class = "fa fa-star"> </i> for as many times as there are stars in a hotel.
I had thought about using the Shortcodes function, but obviously this cannot be used in a "repeatable" section.
What function do you think I could use?

Thank you
I question the choice of repeatable region to add stars to a hotel. Why? A simple dropdown should be enough.
Let me explain better with an image, I have this box where there are the main indications of the trip, before then go to the complete description page.
Trips can be 3 or 100 so I made a repeatable region to exactly recreate this square. The difficulty is precisely how to recreate those stars, which in html translates to:
<i class = "fa fa-star"> </i>
<i class = "fa fa-star"> </i>
<i class = "fa fa-star"> </i>

Attachments

Shortcodes can very well be used within repeatable-regions.
That said, for your particular use-case you don't actually need one; it can easily be done using plain Couch tags.

Suppose, as @trendoman suggested, you have a dropdown named 'stars' in your repeatable-region to hold the count of stars (1 to 5), this is how you may use it to show the stars that many times -
Code: Select all
<cms:repeat count=stars>
    <i class = "fa fa-star"> </i>
</cms:repeat>

Hope this helps.
Ok guys, at the moment I solved it using variables with if / else
So the code becomes:
Code: Select all
<cms:if stelle = '2*' >
                 <i class="fa fa-star"></i>
       <i class="fa fa-star"></i>
             <cms:else />
         <cms:if stelle = '3*' > ........



It would be interesting to use what you suggest, but I don't understand how and which tag to use.
I currently use
Code: Select all
<cms:editable name='stelle'
       label="Stelle Hotel"
       type="text" />
Try this 'mystelle' dropdown:
Code: Select all
<cms:editable type='dropdown' name='mystelle' opt_values='Please select =-|1|2|3|4|5' required='1' />


If you'd like us to quickly and reliably couchify the website, you may ping me or KK.
Thanks, trendoman e KK, now it's clear to me.
This solution also facilitates other fields.
The first part is therefore finished now I will try to generate the descriptive page of the trip. I will have to document myself better following the documentation.
Thanks again.
7 posts Page 1 of 1
cron