ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How can I retrieve the status of a site from within a template

November 19, 2012 10:20am

Subscribe [1]
  • #1 / Nov 19, 2012 10:20am

    Martin de Wit

    150 posts

    Hi,

    I’m looking for a some kind variable (to use in a template) or a query that can tell me if the site is online or not. I tried locating where this info is stored in the database tables but was unable to find it.

  • #2 / Nov 21, 2012 10:56am

    Dan Decker

    7338 posts

    Hi Martin,

    The value for that is stored in the $config array in the ‘is_site_on’ key. This is kept as part of the ‘site_system_preferences’ field in exp_sites. This field holds a base64 encoded serialized PHP array of site preferences, which is why it didn’t turn up in searching.

    Have PHP enabled in a template and set to parse on output:

    <?= $this->EE->config->item('is_site_on'); ?>

    Will echo the value as either ‘y’ or ‘n’.

    What is the context that you need to use this? I may be able to find a better way if I knew how you would use it.

    Cheers,

  • #3 / Nov 22, 2012 6:10am

    Martin de Wit

    150 posts

    Great! I see <?= $this->EE->config->item(‘is_system_on’); ?> works also 😊

    I have a load of tempates, channels and stuff on a site. I want to build a customized version of http://expressionengine.com/wiki/Cheat_Sheet.

    Thanks a lot and enjoy the holiday.

    Cheers,
    Martin

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases