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

[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.

JPDeni

Are you sure you copied the code I posted correctly? Because, while it doesn't actually work on my test site, there are no errors.

Maybe you can try changing


echo '</table></center>';
echo '
</div>
</div>
';


to


echo '</table></center></div></div>';

Kimmen

Yes, when i do that, scrolling don't work. Link now shows in the first row, but i wanted the whole line to be a link, not a own row.

JPDeni


Kimmen

Code is:

global $scripturl;
echo '
<style type="text/css">

#marqueecontainer{
position: relative;
width: 95%; /*marquee width */
height: 150px; /*marquee height */
overflow: hidden;
padding: 2px;
padding-left: 4px;
}

</style>
<script language="javascript" type="text/javascript">

/***********************************************
* Cross browser Marquee II- Ã,© Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=\'\'

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
if(cross_marquee == null)
   return
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarquee()",30)\', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>

<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
';

global $db_prefix;

$topic = 80; // 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 = 'clanwars';  //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 '<center><table border=0>';
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><a href="' . $scripturl . '?topic=' . $lines[6] . '">Link</a></td>';
  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>' . $lines[4] . '</td>';
  echo '<td>' . $lines[5] . '</td>';
  echo '</tr>';
}
echo '</table></center></div></div>';

JPDeni

The scrolling works fine on mine. If it doesn't work on yours, you must be having a problem with your javascript.

As for the link, I don't know what you mean when you say
QuoteLink now shows in the first row, but i wanted the whole line to be a link, not a own row.

The script is set up to be like this:

Link | game image | Clan image | Clan Name | Score | Clan Image | Something | Something

That is one row. The link is in the first column of the row. Each column is in a table cell. It is not possible to maintain the structured printout and, at the same time, make the entire row into a link. Links can not go across table cells.

Now, what is it that you want?

Kimmen

Yes, i want the impossible that you explained. Anywho, thanks for your time JPDeni, you have been really helpful.  :up: :)

bobanss

Is it possible to haw a third color, I mean if the results is equal

JPDeni

It would be nice if people would tell me what is possible. I didn't know there could be ties.

After


$color[0] = 'red';
$color[1] = 'green';


add


$color[2] = 'purple'; // Change this to whatever you want the "tie" color to be


Change


  if (($score_array[0] - $score_array[1]) > 0) {
    $clan1winner = 1;
    $clan2winner = 0;
  }
  else {
    $clan2winner = 1;
    $clan1winner = 0;
  }


to


  if (($score_array[0] - $score_array[1]) == 0) {
    $clan1winner = 2;
    $clan2winner = 2;
  }
  elseif (($score_array[0] - $score_array[1]) > 0) {
    $clan1winner = 1;
    $clan2winner = 0;
  }
  else {
    $clan2winner = 1;
    $clan1winner = 0;
  }

bobanss


Rav33n

Can someone who has used this script please put up a demo image of it in action :) ?

Thanks!

This website is proudly hosted on Crocweb Cloud Website Hosting.