Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi guys,

I want to show the status of the website (online or maintenance mode) in the admin panel.
I have a welcome page (template) where i show some information (updates, date and time and more)

The struggle now is that i can show the status of the website but i need to refresh the welcome.php page in a browser to change the information. And as this is a not visible page in the front end is this a problem.

Please feel free to check the code from the welcompage

Thanks
Bert

Code: Select all
<?php
    require_once( '../admin/cms.php' );
    require_once( '../admin/config.php' );
?>
<cms:template title='Welcome' icon='home' order='1'>
    <cms:config_form_view>
        <cms:field 'my_message' >
        <cms:set site_offline="<?php echo K_SITE_OFFLINE; ?>" />
        <cms:if site_offline == '0'>
            <div class="alert alert-icon alert-success">
                <svg class="i"><use xlink:href="<cms:show svg_link />globe"></use></svg>
                <h2>Site is online.</h2>
            </div>
        </cms:if>
        <cms:if site_offline == '1'>
        <div class="alert alert-icon alert-error">
            <svg class="i"><use xlink:href="<cms:show svg_link />wrench"></use></svg>
            <h2>Site is in maintenance mode</h2>
        </div>
        </cms:if>
    </cms:config_form_view>
    <cms:editable name='hiddener' type='message'>
        <style>
            #header-title, #tabs, #k_label_f_my_message, #settings-panel, #btn_view, #btn_submit {display: none;}
        </style>
    </cms:editable>
</cms:template>
<?php COUCH::invoke(); ?>
Placing the output of current time with seconds may hint you at how to solve this puzzle. The solution is quite simple.

Code: Select all
    <cms:config_form_view>
         <cms:field 'my_message' >
            <cms:date format='H:i:s'/>
           ...
         </cms:field >
    </cms:config_form_view>


Curiously, the closing tag </cms:field> is missing in the posted code. I am sure this is unintentional, thanks to your careful isolating the issue and posting only relevant code, which is good.
trendoman wrote: Placing the output of current time with seconds may hint you at how to solve this puzzle. The solution is quite simple.


Well, i'm still not able to solve the puzzle, The seconds only change when refreshing te page.

trendoman wrote: Curiously, the closing tag </cms:field> is missing in the posted code.


This was indeed an error when copying and erasing the unnecessary code.

Greetings,
Bert
@bertdepoortere

Please modify the following line in your code -
Code: Select all
<cms:set site_offline="<?php echo K_SITE_OFFLINE; ?>" />

- to make it as follows
Code: Select all
<cms:set site_offline="<cms:php> echo K_SITE_OFFLINE; </cms:php>" />

And that should make your code dynamic.

Hope this helps.
@KK,

This worked like a charm!
I'm always amazed at how helpful this couch community is.

Thanks,
Bert
You are welcome Bert :)
6 posts Page 1 of 1