Under construction settings/code
-
Wondering what the best way is to create single page 'under construction' home page, while being able to freely edit and design the rest of the website—including headers and footers. I tried the PHP redirect from the Oncord Developers page, but it kept throwing a redirect error and would load the page (when not logged in as an admin).
-
@Ben Hi Ben, we have achieved this same functionality using the following method.
Step 1) Create a new temporary Design
Create a design and called it Coming Soon or something similar, and attached this design to your single coming soon / under construction page. (On your page, click on Settings icon and then choose your coming soon template under the Design field.Step 2) Lock down your current Design (using PHP method)
Then your current website design, the default Design template for the rest of your website, click the Source icon and then the PHP tab and add the following code:<?php // disable the website until we are ready to launch website. // only homepage 'coming soon' page is available for non admins. if (!\Components\Settings\Administrators::currentIsAdministrator()) { \Framework\HTTP\Redirection::redirect('/'); } ?>
This will redirect all non-logged in Administrators to the homepage, which should be your Under Construction page.
Note, if your Under Construction / Coming soon page is is not the homepage, '/', then replace the code from '/' to your page name, such as '/coming-soon/' or similar.
Hope this helps
-
@StephenBlignault Thank you for your detailed response; that certainly looks like the type of solution I was after. Hadn't thought of using two design templates, but that makes perfect sense. Appreciate the insight and code!
-