Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi Couch-People!

I'm struggling with a couch problem i haven't encountered so far:

I used this code to create editable and repeatable regions for a page (of course, the template has been set up correctly and is displayed accordingly in the backend):

Code: Select all
<cms:repeatable name='Hoerproben'>

<cms:editable
    name='title'
    label='title'
    desc='Titel der Hoerprobe'
    type='textarea' />
   
<cms:editable
    name='mp3'
    label='mp3'
    desc='MP3 Version'
    type='file' />
       
<cms:editable
    name='ogg'
    label='ogg'
    desc='OGG Version'
    type='file' />

</cms:repeatable>


Now i'm using these to be shown repeated in an audio player like this:

Code: Select all
<cms:show_repeatable name='Hoerproben'>             
                              <ul>
                                  <li class="xtitle"><cms:show title /></li>
                                  <li class="ximage">images/p3.jpg</li>
                                  <li class="xsources_mp3"><cms:show mp3 /></li>
                                  <li class="xsources_ogg"><cms:show ogg /></li>
                              </ul>                         
                              </cms:show_repeatable> 


Now when uploading files and refreshing the page, there is nothing being injected into the <li> elements (they are just empty). And the console is throwing up some errors because the player (which uses a .js library) has nothing to play back.

When i use it without the repeatable region as a single file, it works without any errors..

How can i find out what is causing the problem here?

Thanks in advance

Kind regards

Sundance
Hi Sundance,

I had a look at your setup (thanks for the creds) and found there were two problems -

1. The <cms:repeatable> block was defined *outside* the <cms:template> block (following is your original code) -
Code: Select all
 <cms:template title='Hoerproben' /> 

<cms:repeatable name='Hoerproben' >
<cms:editable
    name='title'
    label='title'
    desc='Titel der Hoerprobe'
    type='textarea' />
   
<cms:editable
    name='mp3'
    label='mp3'
    desc='MP3 Version'
    type='file' />
       
<cms:editable
    name='ogg'
    label='ogg'
    desc='OGG Version'
    type='file' />
   
</cms:repeatable>

I rectified that to make the <cms:template> block enclose the <cms:repeatable> tags.

2. The second one is a little tricky. Your original code that was meant to show the regions, defined the name of the region using 'name' parameter (as follows).
<cms:show_repeatable name='Hoerproben'>
<ul>
<li class="xtitle"><cms:show title /></li>
<li class="xauthor">Graphlex Production</li>
<li class="ximage">images/p3.jpg</li>
<li class="xcategory">Graphlex Production</li>
<li class="xsources_mp3"><cms:show mp3 /></li>
<li class="xsources_ogg"><cms:show ogg /></li>
</ul>
</cms:show_repeatable>

According to the documentation (http://docs.couchcms.com/tags-reference ... e.html#var), this is usually left unnamed or termed 'var'. I changed the code to make it as follows -
Code: Select all
<cms:show_repeatable 'Hoerproben'>           
    <ul>
      <li class="xtitle"><cms:show title /></li>
      <li class="xauthor">Graphlex Production</li>
      <li class="ximage">images/p3.jpg</li>
      <li class="xcategory">Graphlex Production</li>
      <li class="xsources_mp3"><cms:show mp3 /></li>
      <li class="xsources_ogg"><cms:show ogg /></li>
    </ul>     
</cms:show_repeatable>   

- and that rectified the issue.

Please check and confirm. Thanks.
KK, you're a lifesaver :D

I knew it had to be some syntax issue, but i didn't know it was something that "stupid" - sometimes when working in code for too long, you miss the obvious things :)

Thank you so much for your quick support :)

Kind regards

Sundace
You are welcome :)
4 posts Page 1 of 1