Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
I have a very beneficial proposal for the principle of operation in cached pages.
Currently cached pages are used until the button Save is not pressed in admin panel - this is good.
I think it's a good idea to have a new editable region checkbox named for example - "Frozen cached pages" (in template for example "Global Settings")
If we fill this checkbox - despite pressing Save - cached pages will not change - ie Couch will continue to display pages without changes.
This new acquisition will allow you to make changes throughout the site - and they are only visible to an administrator.
The administrator can safely make changes to the sliders, banners, new footer design ... without worrying that someone might see their construction.
I know that this can make from a super administrator KK, please reply :). Thanks
Hello again!
I decided this task very easy. Now I have a global checkbox that sets caching mode on/off.
The change is very small and is in a file content_form.html (couch/theme/_system/content_form.html)
Original code:
Code: Select all
<cms:set my_filters="<cms:render 'filters' />" />
<cms:if "<cms:not_empty my_filters />" >
    <div class="filter-actions">
        <cms:show my_filters />
    </div>
</cms:if>
       
<cms:form
    masterpage = k_selected_masterpage
    mode = k_selected_form_mode
    page_id = k_selected_page_id
    enctype = 'multipart/form-data'
    method = 'post'
    anchor = '0'
    add_security_token = '0'
    id = k_cur_form
    name = k_cur_form
    token = k_cur_token
    >

    <div class="tab-pane fade active in" id="tab-pane-edit-<cms:show k_route_module />">
   
        <cms:if k_success >
           
<cms:db_persist_form
    _invalidate_cache='1'
    _token=k_cur_token
/>
           
            <cms:if k_success >
                <cms:if k_redirect_link >
                    <cms:set_flash name='submit_success' value='1' />
                    <cms:redirect k_redirect_link />
                </cms:if>
            </cms:if>
        </cms:if>

        <cms:if k_error >
            <cms:show_error>
                <cms:each k_error >
                    <cms:show item /><br>
                </cms:each>
            </cms:show_error>
        </cms:if>
   
        <!-- advance settings dropdown -->
        <cms:render 'group_advanced_settings' />
       
        <!-- the editable regions -->
        <cms:admin_form_fields depth='1'>
            <cms:render 'form_row' />
        </cms:admin_form_fields>
       
        <div class="ctrl-bot">
            <cms:render 'page_actions' />
            <cms:render 'extended_actions' />
           
            <button class="btn tt" id="top" title="Нагоре" type="button"><cms:show_icon 'arrow-thick-top' /></button>
        </div>
       
        <input type="hidden" id="k_custom_action" name="k_custom_action" value="">
    </div>
</cms:form>


New code:
Code: Select all
<cms:set my_filters="<cms:render 'filters' />" />
<!-- New code -->
<cms:set my_permanent_cache="<cms:get_custom_field 'permanent_cache' masterpage='globals.php' />" 'global' />
<!-- New code -->
<cms:if "<cms:not_empty my_filters />" >
    <div class="filter-actions">
        <cms:show my_filters />
    </div>
</cms:if>
       
<cms:form
    masterpage = k_selected_masterpage
    mode = k_selected_form_mode
    page_id = k_selected_page_id
    enctype = 'multipart/form-data'
    method = 'post'
    anchor = '0'
    add_security_token = '0'
    id = k_cur_form
    name = k_cur_form
    token = k_cur_token
    >

    <div class="tab-pane fade active in" id="tab-pane-edit-<cms:show k_route_module />">
   
        <cms:if k_success >
<!-- Mod code -->      
<cms:if "<cms:show my_permanent_cache />" >
      <cms:db_persist_form
         _invalidate_cache='1'
         _token=k_cur_token
      />
<cms:else />
      <cms:db_persist_form
         _token=k_cur_token
      />
</cms:if>
<!-- Mod code -->           
            <cms:if k_success >
                <cms:if k_redirect_link >
                    <cms:set_flash name='submit_success' value='1' />
                    <cms:redirect k_redirect_link />
                </cms:if>
            </cms:if>
        </cms:if>

        <cms:if k_error >
            <cms:show_error>
                <cms:each k_error >
                    <cms:show item /><br>
                </cms:each>
            </cms:show_error>
        </cms:if>
   
        <!-- advance settings dropdown -->
        <cms:render 'group_advanced_settings' />
       
        <!-- the editable regions -->
        <cms:admin_form_fields depth='1'>
            <cms:render 'form_row' />
        </cms:admin_form_fields>
       
        <div class="ctrl-bot">
            <cms:render 'page_actions' />
            <cms:render 'extended_actions' />
           
            <button class="btn tt" id="top" title="Нагоре" type="button"><cms:show_icon 'arrow-thick-top' /></button>
        </div>
       
        <input type="hidden" id="k_custom_action" name="k_custom_action" value="">
    </div>
</cms:form>


All tests are successful, the question is - this decision is correctly or not?
I hope KK would tell us, thanks.
Seems to be a perfectly fine solution to me :)

One suggestion though - instead of directly modifying the core template (couch/theme/_system/content_form.html), you should *override* it with your modified version. The process is pretty simple and you can find the details in viewtopic.php?f=5&t=10241 under 'Theming'.
Yes of course - I know that!
I am glad that the path is correct - this acquisition is very useful!
For example, today I build new slides for Master slider and I did all this calmly without worrying users of the site.
Thanks for revision KK! :)
4 posts Page 1 of 1
cron