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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 365
  • Total: 365

[Block] Clan war points block : need idea's/help

Started by Heero, June 24, 2008, 05:01:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

c4rver

#60
Thanks for the code, I'm look for that! It would be possible that the winner show in green & looser in red??  Is it possible with a subtraction??
Ex1: Clan A   0 - 4  Clan B
Ex2: Clan A   10 - 4  Clan B

if "score"(ex1:0-4= -4  Ex2: 10-4= 6) is >0 "Clan A" is red and "Clan B" is green else  "Clan A" is green and "Clan B" is red

(sorry for my english)

JPDeni

Yes, it would be possible. :)

Oh! You want me to do it? ;) Tomorrow or Monday.

JPDeni


global $db_prefix;

$topic = 6; // change this to the number of the Drop Report board

$number_to_display = 5; // change this to how many you want to display
$img_dir = 'flags';  //change this to the name of the directory where your clan and game images are
$query = db_query(
    "SELECT mes.body
     FROM {$db_prefix}messages as mes
     WHERE ID_TOPIC = $topic
     ORDER BY posterTime DESC
     LIMIT $number_to_display", __FILE__, __LINE__);
$color[0] = 'red';
$color[1] = 'green';
echo '<table border=1>';
while ($row = mysql_fetch_assoc($query))
{
  $lines = array();
  $lines = explode("<br />", $row['body']);
  $game_img = '<img src="' . $img_dir . '/' . $lines[0] . '">';
  $score = $lines[2];
  $score_array = array();
  $score_array = explode('-',str_replace(" ","",$score));
  if (($score_array[0] - $score_array[1]) > 0) {
    $clan1winner = 1;
    $clan2winner = 0;
  }
  else {
    $clan2winner = 1;
    $clan1winner = 0;
  }
  $clan1 = array();
  $clan1 = explode(") ",$lines[1]);
  $clan1_img = '<img src="' . $img_dir . '/' . substr($clan1[0],1) . '"> ';
  $clan1_name = '<span style="color:' . $color[$clan1winner] . '">' . $clan1[1] . '</span>';
  $clan2 = explode(") ",$lines[3]);
  $clan2_img = '<img src="' . $img_dir . '/' . substr($clan2[0],1) . '"> ';
  $clan2_name = '<span style= "color:' . $color[$clan2winner] . ';">' . $clan2[1] . '</span>';
  echo '<tr>';
  echo '<td>' . $game_img . '</td>';
  echo '<td>' . $clan1_img . ' ' . $clan1_name . '</td>';
  echo '<td>' . $score . '</td>';
  echo '<td>' . $clan2_img . ' ' . $clan2_name . '</td>';
  echo '</tr>';
}
echo '</table>';

c4rver


Heero

Hello JPDeni,
again, thanks for the awesome script, it is still working fine over here!
However I've been using it a very long time, I'd like to slighty modify it.

Is it possible to have everything (the images & text) in one line?
I'm planning to use a marquee scrolling.
And, it isn't that urgent so if you're very busy, np.

A small reply how to do would be fine, thanks :)

JPDeni

The whole thing is set up to be displayed in a table. You can take out the table formatting if you don't want it that way.

Heero

Oh right, I'm such a fool that I didn't see it :D

Thanks, it works now :).

goofyfootejb

I stumbled upon this script and found it very useful and it suited what I was looking for almost perfectly. I was wondering though if it could be modified  a bit so that if you posted two more lines, one being a date and one being a map name (see below), that they would appear in the table in two additional cells. I tried to do it but I don't know php at all so I wasn't able to get anywhere. If you could help me that would be great.

game image
(clan 1 image) Clan 1 name
Score
(clan 2 image) Clan 2 name
date
map name

JPDeni

I don't know where you would get the data for the date and the map name, but structurally it would be like this:


  echo '<tr>';
  echo '<td>' . $game_img . '</td>';
  echo '<td>' . $clan1_img . ' ' . $clan1_name . '</td>';
  echo '<td>' . $score . '</td>';
  echo '<td>' . $clan2_img . ' ' . $clan2_name . '</td>';
  echo '<td>' . $date . '</td>';
  echo '<td>' . $mapname . '</td>';
  echo '</tr>';


You would have to define the $date and $mapname variables, because without knowing where they come from, I can't write the definition.

Also, these are horizontal records, not vertical. It goes:

game image - (clan 1 image) Clan 1 name - Score - (clan 2 image) Clan 2 name - date - map name

goofyfootejb

Quote from: JPDeni on December 23, 2008, 07:48:25 PM
I don't know where you would get the data for the date and the map name, but structurally it would be like this:

You would have to define the $date and $mapname variables, because without knowing where they come from, I can't write the definition.

Also, these are horizontal records, not vertical. It goes:

game image - (clan 1 image) Clan 1 name - Score - (clan 2 image) Clan 2 name - date - map name

I know it goes horizontal. I may have worded it badly so let me try again. Currently, you make a new post in the thread that looks like this to enter the data.

game image
(clan 1 image) Clan 1 name
Score
(clan 2 image) Clan 2 name

What I was trying to do was make it so you enter this into a post.

game image
(clan 1 image) Clan 1 name
Score
(clan 2 image) Clan 2 name
date
map name

so that is shows up in script box the way  you have it in your post

game image - (clan 1 image) Clan 1 name - Score - (clan 2 image) Clan 2 name - date - map name

This website is proudly hosted on Crocweb Cloud Website Hosting.