Problems, need help? Have a tip or advice? Post it here.
16 posts Page 2 of 2
@aleks, I had some time to test your code. Here is what I found -

Firstly, there is no need in config_form_view's styling (especially placed within another editable!!) - you may see in my sample a deliberately emptied and self-closed tag <cms:config_form_view />, because of 2 reasons - first, styling needed for the older version of CouchCMS - before datetime editable had a parameter only_time='1', second, CouchCMS has a known and waiting to be fixed bug that keeps config_form_view's data in db if it was removed with data from a page without being emptied first ("no tag -> no handling" issue).

Secondly, the rest of the code is fine and the problem with date output is another CouchCMS's oversight. I will leave it for @KK to fix it permanently and apply his desired styling of the code, but after some debugging I can suggest a temporary and safe fix. Please navigate to file /couch/addons/mosaic/theme/fields/ctx-setters.php and after the curly brace of the block ends around line 50, paste my fix to make the final result look as follows (with the previous block shown for simplicity) -
Code: Select all
                    // Append time?
                    if( $f->allow_time ){
                        $h = substr( $date, 11, 2 );
                        $m = substr( $date, 14, 2 );

                        if( $f->am_pm ){
                            // 24-hour time to 12-hour time
                            list( $h, $m, $a ) = explode( ":", @date("h:i:A", strtotime("$h:$m")) );
                            $formatted_date .= "@ $h:$m $a";
                        }
                        else{
                            $formatted_date .= "@$h:$m";
                        }
                    }
                   
                    // "Only time" temp fix by @trendoman
                    if( $f->only_time ){
                        $h = substr( $date, 11, 2 );
                        $m = substr( $date, 14, 2 );

                        if( $f->am_pm ){
                            // 24-hour time to 12-hour time
                            list( $h, $m, $a ) = explode( ":", @date("h:i:A", strtotime("$h:$m")) );
                            $formatted_date = "$h:$m $a";
                        }
                        else{
                            $formatted_date = "$h:$m";
                        }
                    }

                    $CTX->set( 'k_date_formatted', $formatted_date );
                }
            }


Does it help?
Say `Please!` [̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]..... Active topics [Forum posts from previous 7 days].... helpcouch@mail.ru [My email for friends]
I have missed the bit about removing <cms:config_form_view /> before. I have removed it now. Thanks for pointing that out!

Your addition to mosaic ctx-setters works as it should have been working initially. Thank you for taking your time and looking into my issue! Hopefully, your fix will be added to release candidate version of CouchCMS 2.2.
Sorry to bother you again @trendoman.

It seems that the repeatable region of trade_hours in mosaic shows just empty field when I run <cms:dump/> even though the backend shows correct dates. I copied the code exactly how you have provided it:

trendoman wrote:
And display code goes -
Code: Select all
<table>
    <tr>
        <th></th>
        <th>September - May</th>
        <th>June - August</th>
    </tr>

    <cms:show_repeatable 'schedule' >
    <tr>
        <td><cms:show my_day /></td>
        <td>
            <cms:if "<cms:not my_winter_off_day />" >
                <cms:date my_winter_opening_time format='g.ia' />-<cms:date my_winter_closing_time format='g.ia' />
            <cms:else />
                Closed
            </cms:if>
        </td>
        <td>
            <cms:if "<cms:not my_summer_off_day />" >
                <cms:date my_summer_opening_time format='g.ia' />-<cms:date my_summer_closing_time format='g.ia' />
            <cms:else />
                Closed
            </cms:if>
        </td>
    </tr>
    </cms:show_repeatable>

</table>



This is getting really frustrating.
Anything defined as Mosaic's tile should be outputted in frontend within the cms:show_mosaic, afaik. I don't see mosaic mentioned in pasted code.. My sample didn't have Mosaic, btw, it was just a repeatable directly placed in the cms:template block, because there was no mention of mosaic in your original post - you just needed "the best way to implement different summer and winter hours in the table head."
Say `Please!` [̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]..... Active topics [Forum posts from previous 7 days].... helpcouch@mail.ru [My email for friends]
It seems that mosaic does not like comments. I had comments inside mosaic and the moment I have removed all them everything started to work as expected.

Again thank you for your patience and willingness to help @trendoman!
aleks wrote: Again thank you for your patience and willingness to help @trendoman!

You are welcome :) Let's see what your next question's going to be :)
Say `Please!` [̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]..... Active topics [Forum posts from previous 7 days].... helpcouch@mail.ru [My email for friends]
16 posts Page 2 of 2

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests