Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-09-21 14:57:10
- gb_ksu
- Member
- Registered: 2007-09-12
- Posts: 20
Display message while site in development...
The site has been in development on a local server and we’re ready to move it to the live server, but there is still some development left to do. All that is really needed is for the home page to display a static page with a message letting everyone (the clients) know that the site is still in development. I haven’t been able to find this option in Textpattern, but in previous experience with other CMSs, it’s just a matter of checking a radio button that the site is not yet live and specifying the message the should be displayed. Then when the site is ready to go live, you simply check a new radio button. Is there a simple way to achieve this in Textpattern? Any help is greatly appreciated. Thanks!
Offline
Re: Display message while site in development...
You could just make a new page and assign it to the default section.
Offline
#3 2007-09-21 15:22:33
- gb_ksu
- Member
- Registered: 2007-09-12
- Posts: 20
Re: Display message while site in development...
I had previously done that, but ran into the following problem. First of all, some of this is a bit new to me, but after trying that, when I click “view site” from Textpattern, it takes me to the new default page. I understand why it does this, but now there is no way to get back to the “home” page of my site, since my navigation for “home” points to the root of the site (which is now the default page). I can get to any of the other sections just fine by typing the URL and then using the navigation from there, but I am still testing certain parts of the home page as well. I’m not sure if this is clear, but I’m trying to explain it the best I can. Let me know if this helps, and if not, I can try to explain it again. I’m sure the solution is something very simple, but I can’t exactly put my finger on it at this point. Thanks.
Offline
Re: Display message while site in development...
You can temporarily add to the top of your index.php file the following. This allows access only from your IP. ‘##.###.###.#’ is your IP. Or alternatively you could use a basic password authentication in the second example. Replace ‘Login’ and ‘Password’ with your own login/pass. You can replace ‘Under construction’ with your own text.
if (!isset($_SERVER['REMOTE_ADDR'] != '##.###.###.#') {
header('WWW-Authenticate: Basic realm="Testing"');
header('HTTP/1.0 401 Unauthorized');
echo 'Under construction';
exit;
}
if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != 'Login' || $_SERVER['PHP_AUTH_PW'] != 'Password') {
header('WWW-Authenticate: Basic realm="Testing"');
header('HTTP/1.0 401 Unauthorized');
echo 'Under construction';
exit;
}
Last edited by cykla (2007-09-21 17:49:52)
Offline
#5 2007-09-21 18:43:35
- gb_ksu
- Member
- Registered: 2007-09-12
- Posts: 20
Re: Display message while site in development...
Thanks Cy, I think the IP solution should work. Is there a way to add multiple IPs to that list? There are a couple of people who need access to the site, so it would be nice to allow another IP access.
Last edited by gb_ksu (2007-09-21 18:47:21)
Offline
Re: Display message while site in development...
hey no problem, create an array of allowed IPs like this:
$allowed[0]="xxx.xxx.xxx.xxx";
$allowed[1]="yyy.yyy.yyy.yyy";
$allowed[2]="zzz.zzz.zzz.zzz";
...
if (!in_array($_SERVER['REMOTE_ADDR'],$allowed))
...
Last edited by cykla (2007-09-21 20:24:41)
Offline
#7 2007-09-21 23:07:58
- gb_ksu
- Member
- Registered: 2007-09-12
- Posts: 20
Re: Display message while site in development...
Cy, the first solution you provided simply returns a blank white page for me, even after I’ve entered my IP. It doesn’t even display an error. Any suggestions? Let me know if I need to be more specific. Thanks!
Offline
Re: Display message while site in development...
gb_ksu wrote:
The site has been in development on a local server and we’re ready to move it to the live server, but there is still some development left to do. All that is really needed is for the home page to display a static page with a message letting everyone (the clients) know that the site is still in development. I haven’t been able to find this option in Textpattern, but in previous experience with other CMSs, it’s just a matter of checking a radio button that the site is not yet live and specifying the message the should be displayed. Then when the site is ready to go live, you simply check a new radio button. Is there a simple way to achieve this in Textpattern? Any help is greatly appreciated. Thanks!
One dirty way of doing it is uploading the site in a directory… If you used relative or txp links for the elements which make up your site, all you will eventually need to do is move it to the home directory and change the usual paths in config.php and the admin. To be on the safe side, you could add a robots noindex/nofollow which you can later edit/remove once the site is on its final location.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: Display message while site in development...
On the first solution he forgot a parenthis. Change
if (!isset($_SERVER['REMOTE_ADDR'] != '##.###.###.#') {
to
if (!isset($_SERVER['REMOTE_ADDR'] != '##.###.###.#')) {
should do the trick.
Plugins:
ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
#10 2007-09-22 14:27:43
- gb_ksu
- Member
- Registered: 2007-09-12
- Posts: 20
Re: Display message while site in development...
This seems so simple, yet it still isn’t working for me. I’m in an office and each computer has the same IP…not sure if that has anything to do with my problems, but I guess it could. I’m placing the code at the top of my index.php file in the root folder, and here is how it looks.
<?php
if (!isset($_SERVER['REMOTE_ADDR'] != '75.52.###.###')) {
header('WWW-Authenticate: Basic realm="Testing"');
header('HTTP/1.0 401 Unauthorized');
echo 'Under construction';
exit;
}
/*
$HeadURL: http://svn.textpattern.com/releases/4.0.5/source/index.php $
$LastChangedRevision: 2436 $
*/
// Make sure we display all errors that occur during initialization
error_reporting(E_ALL);
@ini_set("display_errors","1");
if (@ini_get('register_globals'))
foreach ( $_REQUEST as $name => $value )
unset($$name);
define("txpinterface", "public");
if (!defined('txpath'))
define("txpath", dirname(__FILE__).'/textpattern');
// Use buffering to ensure bogus whitespace in config.php is ignored
ob_start(NULL, 2048);
$here = dirname(__FILE__);
include './textpattern/config.php';
ob_end_clean();
include txpath.'/lib/constants.php';
if (!isset($txpcfg['txpath']) ) {
$status = '503 Service Unavailable';
if (IS_FASTCGI)
header("Status: $status");
elseif ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.0')
header("HTTP/1.0 $status");
else
header("HTTP/1.1 $status");
$msg = 'config.php is missing or corrupt. To install Textpattern, visit <a href="./textpattern/setup/">textpattern/setup/</a>';
exit ($msg);
}
include $txpcfg['txpath'].'/publish.php';
textpattern();
?>
Should I be placing that code elsewhere, or is it in the right place? Thanks for all your help guys, and I apologize that this is taking so much longer than it should.
Last edited by gb_ksu (2007-09-22 14:30:04)
Offline
Re: Display message while site in development...
You can’t use # as some sort of “any number”, you need to specify the IP adress down to the last digit. Also I personally do not see the need for is_set()
. Try:
if ($_SERVER['REMOTE_ADDR'] != 'ADD.IP.ADRESS.HERE') {
header('HTTP/1.0 401 Unauthorized');
echo 'Under construction';
exit;
}
If you want multiple IP-adress’ use the first example with in_array
.
And yes, that position of the code works fine. Otherwise you need to add the above between <txp:php>
tags at the top of every page template.
Plugins:
ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
#12 2007-09-22 14:48:18
- gb_ksu
- Member
- Registered: 2007-09-12
- Posts: 20
Re: Display message while site in development...
I apologize for not being clear about the #s in the IP. I simply removed the last two sets in this post so that my entire IP wasn’t displayed. The actual index.php file contains all of the numbers. I’ll go ahead and give it a shot without is_set(). I’ve also moved it into a sub-directory, but it is on a dedicated server that the client set up (and has access to), so they could still get there if they wanted to. It’s just a little less obvious now. Thanks again for the help!
Offline