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.

PHP in System Offline Template?

December 12, 2007 12:56am

Subscribe [2]
  • #1 / Dec 12, 2007 12:56am

    radar77

    28 posts

    Hello All,
    New to EE and the forums, very happy to have found such a great tool!

    My first question is a simple one:
    Is there anyway to include PHP in the System Offline Template?
    I’d like to pass some variables to this page from referring links to link back out when the site is offline.
    I did see 1 previous post as a feature request to include the flexibility of standard templates in the System Offline Template. This would be quite nice, but perhaps its not there yet.
    Cheers,
    Michael

  • #2 / Dec 12, 2007 1:04am

    Derek Allard

    3168 posts

    Michael, welcome to EE, you’re going to love it.  You are correct that PHP in offline templates is not currently supported.  That said though, if you look into your system/utilities folder, you’ll see a page called offline.html.

    If I were you, I’d rename the main index.php into offline_index.php, and drop offline.html into the main folder.  Then I’d rename it into index.php and place as much PHP into there as you wish.  When you’re ready to take your site online again, simple rename it back to “offline” and restore the name of your index.php page.

    Welcome aboard.

  • #3 / Dec 12, 2007 2:07am

    radar77

    28 posts

    Derek, thanks for the speedy reply. I feel welcome already!
    That solution makes perfect sense and I probably would have never thought of it. Thanks!
    With that then, the System Offline radio button would always be left selected as online, correct? As I understand it, we’re basically just simulating “offline” by manipulating the files. Are there any drawbacks to this approach? I’m assuming this would also work with a mod_rewrite of index.php as well, which I’m considering.

    Thanks again.

  • #4 / Dec 12, 2007 8:08am

    Derek Allard

    3168 posts

    Correct!  We’re simulating offline.  Since in EE everything runs through the index.php page, if it isn’t there then the system is effectively offline.  The drawbacks are that in normal “offline” mode, a super admin can still access the site.  With this solution they can’t.  A good way around that would be to go into CP Home ›  Admin ›  System Preferences ›  General Configuration and set “is the system on” to “no” (making it inaccessible to anyone but super-admin) and then setting “Name of your site’s index page” to “offline_index.php”, making your site available to you at http://www.yoursite.com/offline_index.php

    And of course you’re correct, a mod-rewrite will do it also.

  • #5 / Dec 12, 2007 10:20am

    radar77

    28 posts

    Great, thanks alot Derek! This is exactly what I was looking for.
    Looking forward to delving further and further into this great product.

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

ExpressionEngine News!

#eecms, #events, #releases