Forum for discussing general topics related to Couch.
9 posts Page 1 of 1
First I want to express my thanks for this awesome CMS.
I had tried to convert parts of a static website I had written for several days with several of the well known CMSs and not one made it possible for me to do what I had in mind.

With CouchCMS I could do it in under an hour thanks to the simple way to implement it and the good documentation.

Now only one part remains but I seem to have hit a wall. The site I want to convert is a site listing eventsin three parts. The first part is simple text, that was easy to make editable.

the second part is a table giving an overview of the events.
Typical Row:
Code: Select all
<tr><td>02.10.</td><td>18 h.c.t.</td><td><div class="ho legende"></div> Semesterantrittsconvent</td></tr>


How can I create a template to insert new rows? And can I make a dropdown menu with 4 options to change the class of the div?

The last part is an event calendar covering 4 months. The days with events are color-coded with 4 colors and a popover (realised with bootstrap) that gives some extra informations if you hover over the day or click on it.
The months have to be exchanged every half year for the current set and then the days have to be edited to include the new events. So far I have realised that by editing the source code itself but in the future it has to be editable by someone with no webdev experience whatsoever.

Code: Select all
<td class="off" data-html="true" tabindex="0" data-toggle="popover" data-trigger="focus hover" data-placement="auto" data-container="body" title="Cocktailabend" data-content="20 h.c.t.<br><br>Geselliger Abend<br><br>Damen sind herzlichst willkommen"><span class="date">9</span></td>


That is the code of one day and I want to make the td class editable with 4 options. And the title and data-content editable as text.

I don't know if I have the to recreate the whole thing or if I can use the existing structure somehow.

(I have only begun to learn webdev as a hobby a month and a half ago so I still have much to learn)

Thanks for any help in advance.
Hello and welcome Kadeyrn :)
Thank you for your kind words. I am glad you liked Couch.

Replying to your query -
How can I create a template to insert new rows? And can I make a dropdown menu with 4 options to change the class of the div?
While we could use cloned pages for this, I think using repeatable-regions would be more suitable for your case. Please see http://www.couchcms.com/docs/concepts/r ... gions.html for details. You can define regions for each TD and the dropdown containing the classes would be one of the element.

The last part is an event calendar covering 4 months.
This is a more involved requirement. I think you should take a look at http://www.couchcms.com/docs/concepts/e ... endar.html to see if that would suit you.

Thanks.
Thanks for the reply. I was able to solve the first part with repeatable regions. Much nicer to add events this way instead of editing the source code.

The second problem has been solved partly. I was able to recreate the calendar and the events are editable with repeated regions, but I am unable to connect the events with specific dates,

Code: Select all
<cms:repeatable name='Veranstaltungskalender' >
   <cms:editable type='text' label='Tag' name='vv_datum' />
   <cms:editable
     name="vv_klasse"
     label="Veranstaltungsklasse"
     desc="Wähle eines aus."
     opt_values='ho | o | off | int'
     type='dropdown'
   />
   <cms:editable type='nicedit' label='Titel' name='vv_title' />
   <cms:editable type='nicedit' label='Infotext' name='vv_info' />
</cms:repeatable>

                  <div class="col-md-6">
                  <div class="title"><cms:editable name='monat_1' type='text'>Oktober 2014</cms:editable></div>
                     <cms:calendar  week_starts="1" date="2014-10-01">
                         <table border="1" class="calendar_small">
                            <tr>
                            <cms:repeat count='7'>
                            <th><cms:zebra 'Mo' 'Di' 'Mi' 'Do' 'Fr' 'Sa' 'So'/></th>
                            </cms:repeat>
                        </tr>
                        <cms:weeks>
                            <tr>
                            <cms:days >
                           <cms:if k_timeline_position='present'>
                               <cms:set tdclass='today' />
                           <cms:else />
                               <cms:set tdclass='' />
                           </cms:if>
                               
                           <cms:if k_position='current_month' >
                               <cms:if k_day = vv_datum >
                              <cms:show_repeatable 'Veranstaltungskalender' >
                                 <td class="<cms:show vv_klasse />" data-html="true tabindex="0" data-toggle="popover" data-trigger="focus hover" data-placement="auto" data-container="body" title="<cms:show vv_title />" data-content="<cms:show vv_info />"><cms:show k_day /></td>
                              </cms:show_repeatable>
                               <cms:else />
                              <td class='<cms:show tdclass />' ><cms:show k_day /></td>
                               </cms:if>
                           <cms:else />
                               <td class='other_month'><cms:show k_day /></td>
                           </cms:if>
                            </cms:days>
                            </tr>
                        </cms:weeks>
                         </table>
                     </cms:calendar>


I tried to solve it with if/else

Code: Select all
<cms:if k_day = vv_datum >

But it doesn't show up at the date specified in the variable.
I have the feeling I am only one step away from solving this. Any ideas or tips?

edit: I tried several things by now, but nothing works.
I tried to set it to
Code: Select all
<cms:if k_day = "1" >
for testing purposes and the event showed up at day 1 of the month. So that works. But how can I make it accept a variable for comparison, so that I can set the day with repeatable regions?
edit: Please delete this post
Turns out that it doesn't work as intended after all.

Code: Select all
<cms:repeatable name='Veranstaltungskalender_Monat_1' >
   <cms:editable type='text' label='Tag' name='vv_datum' />
   <cms:editable
     name="vv_klasse"
     label="Veranstaltungsklasse"
     desc="Wähle eines aus."
     opt_values='ho | o | off | int'
     type='dropdown'
   />
   <cms:editable type='nicedit' label='Titel' name='vv_title' />
   <cms:editable type='nicedit' label='Infotext' name='vv_info' />
</cms:repeatable>

<cms:calendar  week_starts="1" date="<cms:editable name='kalendermonat_1' type='text'>2014-10-01</cms:editable>">
               <table border="1" class="calendar_small">
                  <tr>
                  <cms:repeat count='7'>
                  <th><cms:zebra 'Mo' 'Di' 'Mi' 'Do' 'Fr' 'Sa' 'So'/></th>
                  </cms:repeat>
                  </tr>
               <cms:weeks>
                  <tr>
                  <cms:days >
                  <cms:if k_timeline_position='present'>
                     <cms:set tdclass='today' />
                  <cms:else />
                     <cms:set tdclass='' />
                  </cms:if>                         
                  <cms:if k_position='current_month' >
                        <cms:if k_day eq "<cms:show_repeatable 'Veranstaltungskalender_Monat_1' ><cms:show vv_datum /></cms:show_repeatable>" >
                     <cms:show_repeatable 'Veranstaltungskalender_Monat_1' >                           
                        <td class="<cms:show vv_klasse />" data-html="true tabindex="0" data-toggle="popover" data-trigger="focus hover" data-placement="auto" data-container="body" title="<cms:show vv_title />" data-content="<cms:show vv_info />"><cms:show k_day /></td>
                     </cms:show_repeatable>
                     <cms:else />
                     <td class='<cms:show tdclass />' ><cms:show k_day /></td>
                     </cms:if>
                  <cms:else />
                     <td class='other_month'><cms:show k_day /></td>
                  </cms:if>
                  </cms:days>
                  </tr>
               </cms:weeks>
               </table>
            </cms:calendar>


It works if I have only one instance of the repeatable region. But as soon as I add a second event with a different number for "vv_datum" it stops working and the calendar remains empty. Any idea why this does not work with more than one event and how I could make it work with more than one?
Kadeyrn, any reasons why you are not using a separate template for the events (as shown in the documentation sample)?
The cms:calendar tag is built to work with templates only (i.e. cloned pages) and will not work with repeatable regions.
Because I don't really need any cloned pages since I have all informations in the popover itself and with that on one site only. So I thought using it with repeatable regions would be the better solution (and I like to experiment with new tools to see if I can get anything out of it that isn`t covered by tutorials or the documentation).

But if you say that it won't work that way, then I have to change it to cloned pages. Can I draw the generated data from cloned pages like I did it with repeatable regions? So that I can easily add informations into a popover for several specific days in one month?
I don't really need any cloned pages since I have all informations in the popover itself and with that on one site only.
It is a common misconception - that each cloned page necessarily has to represent a discrete page on the front-end. Try to think of a cloned page as simply a record. In your case it can represent an event. You can list all records on a single page if you want.

Can I draw the generated data from cloned pages like I did it with repeatable regions?
Yes, of course. Assuming the template is events.php, the following will list all events -
Code: Select all
<cms:pages masterpage='events.php'>
   .. all editable regions available here..
</cms:pages>

The cms:calendar tag can be made to automatically attach itself to any cloned template to display data on dates. Please see the events docs mentioned before.
It works now. I made it harder for myself than needed.

Thank you very much, you have been a great help.
9 posts Page 1 of 1
cron