Jump to content

Output errors in CMS, need to identify bad syntax in code


AJW

Recommended Posts

Let me preface this by saying that I know zilch about PHP, which is why I'm running into what is probably going to be a silly (and simple) error on my part.

 

I'm trying to set up the Textpattern CMS so that sites on subdomains will share the admin-side code with the primary Textpattern installation. There's a new way of doing this that won't work on shared hosting, so I've had to resort to an older method (http://textpattern.net/wiki/index.php?title=How_to_run_multiple_Sites_off_one_install). The part of the instructions I'm having trouble with goes as follows:

 

  1.  Now go and edit mydomain/textpattern/index.php:

  2. There’s a define() on ± line 20 that says define(“txpath”, dirname(__FILE__));

  3. Change this to say: define(“txpath”, $txpcfg[‘txpath’]);

  4. Move this define to ± line 32 after the code that include()‘s config.php

 

Which sounds simple enough. However, the instructions neglect to specify how the added code on line 32 should be formatted, and where exactly after the include code it needs to be (After the comma? Inside the brackets? Outside?). I've tried it in several places that all failed, and I'm getting a slew of Warning: include() errors because the path hasn't been properly defined and the subdomain is still trying to pull the files from its own folder rather than from the main site's folder.

 

I'm stumped, and any help would be greatly appreciated. The relevant section of code is included below.

 

*/

if (@ini_get('register_globals'))
	foreach ( $_REQUEST as $name => $value )
		unset($$name);

if (!defined('txpath'))
{
	define("txpath", $txpcfg['txpath']);
}

define("txpinterface", "admin");

$thisversion = '4.2.0';
$txp_using_svn = false; // set false for releases

ob_start(NULL, 2048);
if (!isset($txpcfg['table_prefix']) && !@include './config.php' ) {
	ob_end_clean();
	header('HTTP/1.1 503 Service Unavailable');
	exit('config.php is missing or corrupt.  To install Textpattern, visit <a href="./setup/">setup</a>.');
} else ob_end_clean();

 

I discovered that $txpcfg['txpath'] has been deprecated in newer versions of Textpattern by txpath, although the older method involving  $txpcfg['txpath'] is still supposed to work. Also, I'd have no idea how to modify the directions to make txpath work.

Link to comment
Share on other sites

It shouldn't be inside the if() statement that's for sure, so put it after this line:

 

} else ob_end_clean();

 

I find it a bit odd that the documentation says to move the define() as then the if() statement you're moving it from does nothing (because it will be empty).

 

Your new code should look like so:

 

*/

if (@ini_get('register_globals'))
	foreach ( $_REQUEST as $name => $value )
		unset($$name);

if (!defined('txpath'))
{

}

define("txpinterface", "admin");

$thisversion = '4.2.0';
$txp_using_svn = false; // set false for releases

ob_start(NULL, 2048);
if (!isset($txpcfg['table_prefix']) && !@include './config.php' ) {
	ob_end_clean();
	header('HTTP/1.1 503 Service Unavailable');
	exit('config.php is missing or corrupt.  To install Textpattern, visit <a href="./setup/">setup</a>.');
} else ob_end_clean();

define("txpath", $txpcfg['txpath']);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.