Greetings! I'm developing my own wiki and installed v1.6.5. I use MySQL v5.0.83. The wiki itself functions fine but after adding the extension Cite.php and adding the call command require_once( "$IP/extensions/Cite/Cite.php"); it gives me the stubborn fatal error message Fatal error: Class 'Cite' not found in $IP/wiki/extensions/Cite/Cite.php on line 54.
From my research this is failing to call Cite.php from itself which sounds impossible. Truly at a loss here.

Cite.php:

<?php
if ( ! defined( 'MEDIAWIKI' ) )
	die();
/**#@+
 * A parser extension that adds two tags, <ref> and <references> for adding
 * citations to pages
 *
 * @addtogroup Extensions
 *
 * @link http://www.mediawiki.org/wiki/Extension:Cite/Cite.php Documentation
 *
 * @bug 4579
 *
 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 */

if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
	$wgHooks['ParserFirstCallInit'][] = 'wfCite';
} else {
	$wgExtensionFunctions[] = 'wfCite';
}

$wgExtensionCredits['parserhook'][] = array(
	'path' => __FILE__,
	'name' => 'Cite',
	'author' => 'Ævar Arnfjörð Bjarmason',
	'description' => 'Adds <nowiki><ref[ name=id]></nowiki> and <nowiki><references/></nowiki> tags, for citations', // kept for b/c
	'descriptionmsg' => 'cite_desc',
	'url' => 'http://www.mediawiki.org/wiki/Extension:Cite/Cite.php'
);
$wgParserTestFiles[] = dirname( __FILE__ ) . "/citeParserTests.txt";
$wgExtensionMessagesFiles['Cite'] = dirname( __FILE__ ) . "/Cite.i18n.php";
$wgAutoloadClasses['Cite'] = dirname( __FILE__ ) . "/Cite_body.php";
$wgSpecialPageGroups['Cite'] = 'pagetools';

define( 'CITE_DEFAULT_GROUP', '');
/**
 * The emergency shut-off switch.  Override in local settings to disable
 * groups; or remove all references from this file to enable unconditionally
 */
$wgAllowCiteGroups = true; 

/**
 * An emergency optimisation measure for caching cite <references /> output.
 */
$wgCiteCacheReferences = false;

function wfCite() {
	new Cite;
	return true;
}

/**#@-*/

Recommended Answers

Answered by darkagn 315 in a post from

The line:

new Cite;

means that there needs to be a class called Cite, not a file called Cite.php. Even if there was a Cite class, the code in the wfCite function wouldn't need that line as it doesn't reference the object after that. Remove that line …

Jump to Post

All 3 Replies

The line:

new Cite;

means that there needs to be a class called Cite, not a file called Cite.php. Even if there was a Cite class, the code in the wfCite function wouldn't need that line as it doesn't reference the object after that. Remove that line and your code should be fine.

tried it. Removed new Cite; and the page loads but it fails to do anything when I put in the <ref></ref><references /> tags. It must be trying to create the Cite class for use with further handling.

The line error is actually being returned as Line 51 - which is new Cite; I just don't know what to do about it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.