TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,234
  • Total Topics: 21,353
  • Online today: 739
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 608
  • Total: 609
  • @rjen

Block not displaying correctly

Started by drgnmstr, October 11, 2007, 01:16:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

drgnmstr

Hello,
I am fairly new to php but trying...    :) I just dumped our original site and changed everything over to SMF from integramod and am having some difficulty applying my knoweledge of that to get SMF to do what I want.
I need to install a roster in a side block on our website. I have modified a script that pulls our roster data from another site and displays it and clicking on a link will take you to that members profile on the other site. If I use a html side block and use an iframe to call the roster.php it displays, but the background is white and the font is wrong. I am using the default theme, nothing fancy there. I tried copy/paste the code to a php block but I get no diplay at all. I need to find out how to post the code as a php block so it displays, or whatever I need to do to make the current roster display with the default themes background and font. ANy help would be greatly appreciated! The forum url is http://teamaj.net
The php code is:

<?php
$clanid="32643";

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);
}


// Parse XML

$stack = 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.com/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);


// Get Data

// Get Player Data
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;
  }
}

// Now we have 1 arrays with all stats and infos
// print_r($playerstats);

// Display Player Stats
echo "AJ Roster:

\n";

foreach($playerstats as $key => $value) {
$playername=$playerstats[$key][PLAYERNAME];
$playerhonor=$playerstats[$key][PLAYERHONOR];
$playerurl=$playerstats[$key][PLAYERSTATSURL];

if($playerstats[$key][PLAYERSTATUS]=="1") $statuspic="ponline.gif";
else $statuspic="poffline.gif";

echo "<a target=\"_blank\" href=\"$playerurl\"><font size=\"2\" color=\"#000000\">$playername ($playerhonor)</font></a>
\n";
}
?>

Thank you for your assistance or direction to where I can find this info!

G6Cad

Welcome to tinyportal :)

First off, when you post code in the posts, please use the code tags or the code you want to show will be parsed wrongly.

Second, i think we have a rooster block for tiny portal made in the block code and snippets board.
If you look in that board, you will see a post with block code and snippets index.

Also this post should have been placed in that very forum (block code and snippets/requests)

drgnmstr

#2
Thanks, but the roster block/snippets won't work because I do not want to list members of the website, but members of our "clan" linked back to teh AAO tracker site wich is what that particular code is for. I guesss my only issue is getting the current block to display with the forums background and font. Sorry if I posted in wrong forum, but it really deals with this working with teh default theme, (colors & fonts), not an issue with getting the block to display as I have found a way to do that. All my other blocks display the correct theme colors and fonts so I am not sure why only this one does not.. Actually, I still don't know.    :'(

G6Cad

The code you posted in your first post have errors in it cause you didnt use the code tags in the post when you posted it.

But if you used that code in a php block, and had the php tags added, the block will not render the code with out an error on line 1.

remove the php tags on the first and last line and then add the code in a php block again and try if that take you a step forward.

drgnmstr

Yeah, I tried that too, I looked at how the other php blocks code was written in the blocks and tried stripping the tags in the block, but when I do it that way nothing displays at all. Just a big long empty box. Using an html box and calling the php from a file in an iframe will display the box correctly as far as the content, however that is where I have the issue with no background, (just white background) and the wrong font. I am really sorry if I am just being to stupid to figure this out, but I have already tried every combination I could think of and well, here I am. I really do appreciate your help though. Thanks... Guess I'm just stuck with the one white side box. You can see what I am talking about at http://teamaj.net it is the roster box on the right hand side.

This website is proudly hosted on Crocweb Cloud Website Hosting.