You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 109 guest(s) and 5 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - block error [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
3D-Philly
Nuke Cadet
Nuke Cadet


Joined: Feb 16, 2007
Posts: 4


PostPosted: Fri Feb 16, 2007 7:13 am Reply with quoteBack to top

hi,

ok im trying to make a block,
when i use the script direct (not in a block or via nuke) it works fine apart from a load of notices, but when i make it into a block it gives me the following warning:
Code:
Warning: array_push() [function.array-push]: First argument should be an array in G:\usr\aagroups.com\public_html\blocks\block-My_Stats.php on line 11


block-My_Stats.php
Code:
<?php

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

function startTag($parser, $name, $attrs) {
   global $stack;
   $tag=array("name"=>$name,"attrs"=>$attrs);
   array_push($stack,$tag);
}
function cdata($parser, $cdata) {
   global $stack;
   $stack[count($stack)-1]['cdata'] .= $cdata;   
}
function endTag($parser, $name) {
   global $stack;
   $stack[count($stack)-2]['children'][] = $stack[count($stack)-1];
   array_pop($stack);
}


$clanid="57822";
$playid="639739";
$stack = array();
$claninfo = array();
$clanstats = array();
$playerstats = array();
$xml_parser = xml_parser_create();

xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "cdata");
$xmllink="http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=$clanid";
$data = xml_parse($xml_parser,file_get_contents($xmllink));
if(!$data) die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
xml_parser_free($xml_parser);

for($i = 0; $i < sizeof($stack[0][children][2][children]); $i++) {
   for($x = 0; $x < sizeof($stack[0][children][2][children][$i][children]); $x++) {
      $valname=$stack[0][children][2][children][$i][children][$x][name];
      $value=$stack[0][children][2][children][$i][children][$x][cdata];
      if($valname=="PLAYERID") $pid=$value;
      $playerstats[$pid][$valname]=$value;
   }
}

foreach($playerstats as $key => $value) {
   $gplayerid=$playerstats[$key][PLAYERID];
   
   if ($gplayerid==$playid) {
      $player_name=$playerstats[$key][PLAYERNAME];
      $player_honor=$playerstats[$key][PLAYERHONOR];
      $player_score=$playerstats[$key][PLAYERSCORE];
      $player_kills=$playerstats[$key][PLAYERKILLS];
      $player_died=$playerstats[$key][PLAYERDEATHS];
      $player_status=$playerstats[$key][PLAYERSTATUS];
      if($player_status==0){
         $player_status = "Offline";
      }else{
         $player_status = "Online";
      }
   
   }
}

if (!isset($player_name)) {
   $content = "<br><center>Player Not Found</center><br>";
} else {
   $content = "<br><center>$player_name<br>Honor: $player_honor<br>Score: $player_score<br>Kills: $player_kills<br>Died: $player_died</center><br>";
}
?>


to use this outside nuke just remove the following few lines

Code:
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}



can anyone tell me why?

thanks
Find all posts by 3D-PhillyView user's profileSend private message
arnoldkrg
Major
Major


Joined: Aug 03, 2003
Posts: 937

Location: United Kingdom

PostPosted: Fri Feb 16, 2007 11:10 am Reply with quoteBack to top

In your block code find:
Code:
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}


and underneath add:
Code:
global $stack;


Tested and working on a nuke 8.0 site.

_________________
Image
Find all posts by arnoldkrgView user's profileSend private messageSend e-mailVisit poster's website
3D-Philly
Nuke Cadet
Nuke Cadet


Joined: Feb 16, 2007
Posts: 4


PostPosted: Fri Feb 16, 2007 2:01 pm Reply with quoteBack to top

thanks arnoldkrg, worked perfect.
Find all posts by 3D-PhillyView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.176 Seconds - 266 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::