Hello,
I am having an issue getting more than one Tag Extension working on the same page. I have
included the code that i am using for the two pages that make up the extension. Has anyone
had any luck getting
more than one tag extension working on the same page? If so what steps did you use to make
it work? Any help would be appreciated!
<?php
#serverTag.php
# Credits
$wgExtensionCredits['other'][] = array(
'name' => 'ServerTag',
'description' => 'Print All Servers Based On Client Page Name.',
'version' => '1.0');
# Set up the hook, using different logic depending
# on the version of MediaWiki
if (defined('MW_SUPPORTS_PARSERFIRSTCALLINIT')) {
$wgHooks['ParserFirstCallInit'][] = 'ServerTag::setup';
} else {
$wgExtensionFunctions[] = 'ServerTag::setup';
}
# Autoload the implementation class
$wgAutoloadClasses['ServerTag']
= dirname( __FILE__ ) . "/ServerTag_body.php";
and
<?php
//ServerTag_body.php
class ServerTag {
const NAME = 'servers';
static function setup() {
global $wgParser;
$wgParser->setHook(self::NAME, array('ServerTag', 'render'));
return true;
}
static function render() {
//required for DB connection
require "db_mysql.inc";
require "define_hosts.php";
// Connection Parameters
$em_g3 = new DB_MySQL;
$em_g3->Host = $em_g3_host;
$em_g3->User = $em_g3_user;
$em_g3->Password = $em_g3_pw;
$em_g3->Database = "biz";
$em_g3->connect();
//Get end of URL remove _ from client name for DB query
$endURL = $_GET["title"];
$phrase = $endURL;
$healthy = array("_");
$yummy = array(" ");
$newphrase = str_replace($healthy, $yummy, $phrase);
//Run DB query and run though loop to get DB client data
if ($newphrase) {
$q = "SELECT company, device,master_dev.legend_device.active,
master_dev.device_ip_addr.ip from master_biz.`organizations` left join
master_dev.legend_device on master_biz.`organizations`.roa_id =
master_dev.legend_device.roa_id left join master_dev.device_ip_addr on
master_dev.legend_device.id = master_dev.device_ip_addr.did where company =
'$newphrase'";
$em_g3->query($q);
$acnt = "";
$table ="<table border='4'>";
while ($em_g3->next_record()) {
$company = $em_g3->f("company");
$device = $em_g3->f("device");
$active = $em_g3->f("active");
$ip = $em_g3->f("ip");
$acnt = $acnt + 1;
if ($company) {
if ($acnt){
$addr_list[$acnt] =
"<tr><td>$company</td><td>$device</td><td>$active</td><td>$ip</td></tr>";
$string = $string.$addr_list[$acnt];
}
}
}
$tableEnd="</table>";
return $table.$string.$tableEnd;
}
}
}
Mike Cody
Systems Administrator
RELIAM
(310) 348-9700 x 2 ( Support )
(310) 348-9797 FAX
----
Blog:
http://www.reliam.com/news/reliam_blog
Twitter:
http://www.twitter.com/reliam
Facebook:
http://www.facebook.com/reliam
----