Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Latebalazoo
Hangin' Around



Joined: Nov 06, 2005
Posts: 30

PostPosted: Mon Nov 21, 2005 6:24 am Reply with quote

Hello,

I have a problem, I would like to make a module for my clan's website where I could display match results Clanbase straight. They have a javascript system for that. I have tried to put that in a module, but with no success yet.

If someone has an idea how to do this. please help me!

Clanbase has in it's FAQ this:

How can we display a list of ClanBase matchresults on our website ?
We've created a special page that outputs JavaScript function calls for all matches of a given clan. By including a special javascript tag and a set of custom javascript functions you can display the matches you played in your own format.
For more information see this sample.

If you wish to use a local time different from GMT you need to parse the date string, adjust the hour and replace "date" with "parseCBDate(date)".

function parseCBDate(str) {
var parts = str.split(' ');
var time = parts[1].split(':');
time[0]+?; //adjust hour here
document.write(parts[0]+" "+time[0]+":"+time[1]+":"+time[2]);
}

Just add x hours to time[0] and you got your local time.


and the sample is here: http://www.clanbase.com/cbjs_sample.php

As said I am ready to try anything so please, if you know/have an idea, let me know.

Thänx alot!
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Nov 21, 2005 7:04 am Reply with quote

Latebalazoo,

I see from the page you reference that they say "If you have questions about the use of these javascript pages please post a message
on the helpdesk forum." Have you tried to implement their code outside of Nuke just on a simple page to make sure you have included their code appropriately? I would start there first -- if you have not already -- and use their support forum to help you get that test page working.

If you have already done all of that and the issue is getting this working now inside a nuke module, what specific issue are you having with it? Is there a site on the net where we can see what output you are getting?

Just a little more info would help us help you.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Latebalazoo







PostPosted: Mon Nov 21, 2005 7:25 am Reply with quote

Hello,

Yes, I have posted to their hlepdesk forum.

Yes, I have tested the code: Only registered users can see links on this board! Get registered or login! (this is basic html)

No, I have got this to work with PHP (which is not suprise, I suck at PHP).

I think that the biggest problem I have is to import this javascript into nuke module or even .php

I have been reading this: Only registered users can see links on this board! Get registered or login! but can't make it work in nuke.
 
Latebalazoo







PostPosted: Mon Nov 21, 2005 10:03 am Reply with quote

The result in PHP-Nuke is like this: Only registered users can see links on this board! Get registered or login!

Don't know why, but I can't show the code here, even when I use the Code button? But you can see it here: Only registered users can see links on this board! Get registered or login!
 
montego







PostPosted: Tue Nov 22, 2005 6:25 am Reply with quote

Latebalazoo wrote:
The result in PHP-Nuke is like this: Only registered users can see links on this board! Get registered or login!

Don't know why, but I can't show the code here, even when I use the Code button? But you can see it here: Only registered users can see links on this board! Get registered or login!


The reason you are unable to post the code is that it has script tags in it, which is a common attack that hackers use, so it is blocked here. Generally speaking, you can insert a space in the HTML tag name itself to avoid this issue... just for future reference.

Now, on to the problem at hand. I can see that your script tags look as follows:

Code:


  . "<s cript language=\"JavaScript\" type=\"text/JavaScript\">"
  . "<s cript src='http://www.clanbase.com/cbjswarpast.php?cid=1'></s cript>"


Try changing these to:

Code:


  . "<s cript language=\"JavaScript\" type=\"text/JavaScript\" src='http://www.clanbase.com/cbjswarpast.php?cid=1'></s cript>"


** Remember that I inserted a space in the tags above.

You have an extra set of script tags with no source being called out. Also, I have not had very good luck with module "generator" tools with all but the most basic of HTML, so I am not sure if the generator placed these extra tags in or if your original HTML had it, but the bottom line is that line 192 on your referenced page had a javascript error on it.

This should get you closer... Again, let us know how this goes.
 
Latebalazoo







PostPosted: Tue Nov 22, 2005 9:16 am Reply with quote

Tried this:

Code:


  . "<s cript language=\"JavaScript\" type=\"text/JavaScript\" src='http://www.clanbase.com/cbjswarpast.php?cid=1'></s cript>"


But nothing happend. I tried if the problem was that the script that "call" it is on the top, but that didn't change anything.

In clanbase helpdesk, they said something about making a manual page (didn't get that...Shocked ).

The code that I have now is:

Code:
<?php

#### Generated by Module Creator - By Disipal site (www.disipal.net) ####
if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");

}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
$index = 0;
OpenTable();
echo"<s cript>"
  . "var count = 0;"
  . "var count2 = 0;"
  . "//"
  . "//   This function is called BEFORE enumerating"
  . "//   all wars. Use it to start a table etc"
  . "//"
  . "function cbjsWarPast_Start()"
  . ""
  . "document.write(\"<table border='0' cellpadding='1' cellspacing='1'>\");"
  . "document.write(\"<tr>\");"
  . "document.write(\"<td class='small'>Clan</td>\");"
  . "document.write(\"<td class='small'>Date</td>\");"
  . "document.write(\"<td class='small' colspan='2'align='center'>Score</td>\");"
  . "document.write(\"<td class='small'>Maps</td>\");"
  . "document.write(\"<td class='small'>Ladder</td>\");"
  . "document.write(\"<td class='small'>Forfeit</td>\");"
  . "document.write(\"<td class='small'>Demo</td>\");"
  . "document.write(\"</tr>\");"
  . ""
  . "//"
  . "//   This function is called AFTER enumerating"
  . "//   all wars. Use it to start end table etc"
  . "//"
  . "function cbjsWarPast_End()"
  . ""
  . "document.write(\"</table>\");"
  . ""
  . "//"
  . "//   This function is called for each war"
  . "//"
  . "function cbjsWarPast_Each(wid,clan,cid,lid,date,score1,score2,level1,level2,"
  . "game,subgame,forfeit,type,hasdemo)"
  . ""
  . "if(count >= 25)"
  . "   return;"
  . "//   Only official matches"
  . "if(type!=0)"
  . "   return;"
  . "//   Skip forfeit wins"
  . "if(forfeit=='Y')"
  . "   return;"
  . "//   score1 is our score"
  . "//   (an interesting usage would we: if(score1 < score2) return; !"
  . "if(score1 > score2)"
  . "   document.write(\"<tr bgcolor='#008000'>\");"
  . "else"
  . "if(score1 < score2)"
  . "   document.write(\"<tr bgcolor='#800000'>\");"
  . "else"
  . "   document.write(\"<tr bgcolor='#000000'>\");"
  . "document.write(\"<td class='small'><a href='http://www.clanbase.com/claninfo.php?cid=\"+cid+\"' class='slink' target='bla'>\"+clan+\"</a></td>\");"
  . "document.write(\"<td class='small'>\"+date+\"</td>\");"
  . "document.write(\"<td class='small' align='right'>\"+score1+\"</td>\");"
  . "document.write(\"<td class='small' align='right'>\"+score2+\"</td>\");"
  . "document.write(\"<td class='small'>\"+level1+\"/\"+level2+\"</td>\");"
  . "document.write(\"<td class='small'><a href='http://www.clanbase.com/rating.php?lid=\"+lid+\"' class='slink' target='bla'>\"+game+\"/\"+subgame+\"</a></td>\");"
  . "document.write(\"<td class='small' align='center'>\"+forfeit+\"</td>\");"
  . ""
  . "document.write(\"<td class='small' align='center'>\");"
  . "if(hasdemo=='Y')"
  . "   document.write(\"<a href='http://www.clanbase.com/demolist.php?post=1&wid=\"+wid+\"' class='slink' target='bla'><img src='http://www.clanbase.com/demo.gif' border='0'></a>\");"
  . "else"
  . "   document.write(\" \");"
  . "document.write(\"</td>\");"
  . "document.write(\"</tr>\");"
  . "count++;"
  . ""
  . ""
  . "function cbjsWarUpcoming_Start()"
  . ""
  . "// Do nothing !"
  . ""
  . "function cbjsWarUpcoming_End()"
  . ""
  . "//   Do nothing !"
  . ""
  . "function cbjsWarUpcoming_Each(wid,clan,cid,lid,date,level1,level2,game,subgame,type)"
  . ""
  . "//   Only show first match"
  . "if(count2)"
  . "   return;"
  . "//   Note: the date is GMT"
  . "//   Converting this date to localtime is left as an excercise for the reader :-)"
  . "document.write(\"Next war: <a href='http://www.clanbase.com/claninfo.php?cid=\"+cid+\"' class='slink' target='bla'>\"+clan+\"</a>\");"
  . "document.write(\", \"+date+\"\");"
  . "document.write(\", <a href='http://www.clanbase.com/rating.php?lid=\"+lid+\"' class='slink' target='bla'>\"+game+\"/\"+subgame+\"</a>\");"
  . "document.write(\", <a href='http://www.clanbase.com/warinfo.php?wid=\"+wid+\"' class='slink' target='bla'>details</a>\");"
  . "count2++;"
  . ""
  . "  </s cript>"
  . "</p>"
  . "<h2>Matchresults:</h2><br><br>"
  . "<s cript language=\"JavaScript\" type=\"text/JavaScript\" src='http://www.clanbase.com/cbjswarpast.php?cid=861909'></s cript>"
  . "<br>"
  . "<br>"
  . "<h2>Upcoming matches:</h2><br><br>"
  . " <s cript language=\"JavaScript\" type=\"text/JavaScript\" src='http://www.clanbase.com/cbjswarupcoming.php?cid=861909'></s cript>";

CloseTable();
include("footer.php");

?>


I looked at the original code and the one made by module generator (I think that I corrected all of it Rolling Eyes ).

EDIT: I know that the "generator" is not very good, but unfortunatly (as said before, I think) I suck with php.
 
Latebalazoo







PostPosted: Tue Nov 22, 2005 10:08 am Reply with quote

OMG! RavensScripts

I did this:

Code:
<?php

if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
$index = 0;   // 0 : do not show right blocks - 1:show right blocks
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
OpenTable();
?>
<s cript>
var count = 0;
var count2 = 0;

//
//   This function is called BEFORE enumerating
//   all wars. Use it to start a table etc
//
function cbjsWarPast_Start()
{
   document.write("<table border='0' cellpadding='1' cellspacing='1'>");
   document.write("<tr>");
   document.write("<td class='small'>Clan</td>");
   document.write("<td class='small'>Date</td>");
   document.write("<td class='small' colspan='2'align='center'>Score</td>");
   document.write("<td class='small'>Maps</td>");
   document.write("<td class='small'>Ladder</td>");
   document.write("<td class='small'>Forfeit</td>");
   document.write("<td class='small'>Demo</td>");
   document.write("</tr>");
}

//
//   This function is called AFTER enumerating
//   all wars. Use it to start end table etc
//
function cbjsWarPast_End()
{
   document.write("</table>");
}

//
//   This function is called for each war
//
function cbjsWarPast_Each(wid,clan,cid,lid,date,score1,score2,level1,level2,
game,subgame,forfeit,type,hasdemo)
{
   if(count >= 25)
      return;
   //   Only official matches
   if(type!=0)
      return;
   //   Skip forfeit wins
   if(forfeit=='Y')
      return;
   //   score1 is our score
   //   (an interesting usage would we: if(score1 < score2) return; !
   if(score1 > score2)
      document.write("<tr bgcolor='#008000'>");
   else
   if(score1 < score2)
      document.write("<tr bgcolor='#800000'>");
   else
      document.write("<tr bgcolor='#000000'>");
   document.write("<td class='small'><a href='http://www.clanbase.com/claninfo.php?cid="+cid+"' class='slink' target='bla'>"+clan+"</a></td>");
   document.write("<td class='small'>"+date+"</td>");
   document.write("<td class='small' align='right'>"+score1+"</td>");
   document.write("<td class='small' align='right'>"+score2+"</td>");
   document.write("<td class='small'>"+level1+"/"+level2+"</td>");
   document.write("<td class='small'><a href='http://www.clanbase.com/rating.php?lid="+lid+"' class='slink' target='bla'>"+game+"/"+subgame+"</a></td>");
   document.write("<td class='small' align='center'>"+forfeit+"</td>");
   
   document.write("<td class='small' align='center'>");
   if(hasdemo=='Y')
      document.write("<a href='http://www.clanbase.com/demolist.php?post=1&wid="+wid+"' class='slink' target='bla'><img src='http://www.clanbase.com/demo.gif' border='0'></a>");
   else
      document.write(" ");
   document.write("</td>");
   document.write("</tr>");
   count++;
}


function cbjsWarUpcoming_Start()
{
//   Do nothing !
}

function cbjsWarUpcoming_End()
{
//   Do nothing !
}

function cbjsWarUpcoming_Each(wid,clan,cid,lid,date,level1,level2,game,subgame,type)
{
   //   Only show first match
   if(count2)
      return;
   //   Note: the date is GMT
   //   Converting this date to localtime is left as an excercise for the reader :-)
   document.write("Next war: <a href='http://www.clanbase.com/claninfo.php?cid="+cid+"' class='slink' target='bla'>"+clan+"</a>");
   document.write(", "+date+"");
   document.write(", <a href='http://www.clanbase.com/rating.php?lid="+lid+"' class='slink' target='bla'>"+game+"/"+subgame+"</a>");
   document.write(", <a href='http://www.clanbase.com/warinfo.php?wid="+wid+"' class='slink' target='bla'>details</a>");
   count2++;
}

</s cript>


Matchresults:<br><br>
<s cript src='http://www.clanbase.com/cbjswarpast.php?cid=861909'></s cript>
<br><br><br>
Upcoming matches:<br><br>
<s cript src='http://www.clanbase.com/cbjswarupcoming.php?cid=861909'></s cript>
<?php
CloseTable();
include("footer.php");
?>


I used the idea in "PHP Nuke How to" guide.

AND IT WORKS! Well the layout isn't perfect yet (hope that I can make it look better, BUT IT WORKS!)

I might need still some help with this, but for now, it's enough!

Thanx for your time montego!
 
Latebalazoo







PostPosted: Tue Nov 22, 2005 10:21 am Reply with quote

LOL! 1 question still!

Normally it looks like this: Only registered users can see links on this board! Get registered or login! (I mean the colors red, green and black)

But Nuke shows it like this: Only registered users can see links on this board! Get registered or login! How can I make Nuke put those colors that are in the JavaScript?

I know... I'm a pain in the ***. As soon as I get something to work I am asking new questions. Razz
 
montego







PostPosted: Wed Nov 23, 2005 6:50 am Reply with quote

Latebalazoo,

You are not a pain in the ****! This is what these Forums are for. Ask as you need to ask.

First of all, great job on working through the issues!

Wave

Next, regarding the colors, I see that the javascript is calling out class = "small" and I have a feeling that this line in your theme's CSS file is overriding your color scheme:

Code:


.small       {BACKGROUND: none; COLOR: #D0CEB8; FONT-SIZE: 9px; FONT-WEIGHT: normal; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none}


Instead of using a class statement here, I would suggest using something more like the following:

Code:


document.write("<td><small>Date</small></td>");


By the way, your examples above were perfect for me to see what might be going on. I'm not 100% certain that the class statement is causing the issue, so please let me know if you have any other issues.

Regards,
montego
 
Latebalazoo







PostPosted: Wed Nov 23, 2005 8:16 am Reply with quote

montego, you are a genius! worship

The colors are like they should be! Once again thanx a million Very Happy
 
montego







PostPosted: Wed Nov 23, 2005 8:41 am Reply with quote

Cheers
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous 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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©