Daniel,
Thanks for getting for responding!
These are the two pages of code I have going.
Both pages are working great. Just when I try and add another tag extension to a page I
have problems.
The major difference in the pages are the tag names and the query that I am running. other
than that they are based on the same code foundation.
<?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 = "master_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
----
On Aug 10, 2011, at 1:28 PM, Daniel Friesen wrote:
By any chance are you using $parser->parse inside
any of those extensions?
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [
http://daniel.friesen.name]
On 11-08-10 11:09 AM, Mike Cody wrote:
I am working on a few custom tag extensions. I
have a few of them working great and I am happy with them, but I am having a problem
getting more than one to work at the same time on the same page.
Has anyone had this problem and had success solving it? Any suggestions would be most
appreciated!
Thanks
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
----
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l