TinyPortal

Development => Resources => Topic started by: rebelrose on June 05, 2007, 01:57:33 AM

Title: TP and phpraider block
Post by: rebelrose on June 05, 2007, 01:57:33 AM
Can anyone tell me how to pull the infofrom the database and show them in a block, the info needed is from phpraider which is installed in the database.

Wanting to show upcoming raids etc.

something like this:

06/04 - 6:30pm(CST): Raid info  (IN PROGRESS)
06/06 - 6:30pm(CST): Raid info 
06/07 - 6:30pm(CST): Raid info 
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 02:05:36 AM
is it part of the smf database? as in a mod or something. need to setup some globals and do a sql call for what you want basically.
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 02:06:32 AM
Quote from: StormLrdâ„¢ on June 05, 2007, 02:05:36 AM
is it part of the smf database? as in a mod or something. need to setup some globals and do a sql call for what you want basically.

I don't know how to do that Storm :-\
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 02:11:25 AM
do you have some kind of code somewhere for this? i need a point to start hun lmao.
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 02:15:09 AM
This came from a site using Mkportal, but does what we need I just don't know how to put it in TP.


<?php

$rootlink 
"http://www.nethergard.com/phpraider/index.php?option=com_view&id";

function 
newDate$format$timestamp$tz ) {
$offset = (60 60) * ($tz 100); // Seconds from GMT
    
$timestamp $timestamp $offset;
    return 
gmdate$format$timestamp );
}

if (!
defined("IN_MKP")) {
    die (
"Sorry !! You cannot access this file directly.");
}
$content "";
$pConfig_timezone = -500;
$offset = (60 60) * ($pConfig_timezone/100);
$time_buffer = (60 60) * 2;  
$rightnow time() + $offset;
$future $rightnow $time_buffer;


//$DB->query("DELETE FROM mkp_chat WHERE run_time < ".$dead_users." ");
$DB->query("SELECT raid_id, location, start_time, raid_leader FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC ");

$sep ",";
$totalraids $DB->get_num_rows();


while ($raids $DB->fetch_row()) {
$year newDate"Y"$raids['start_time'], $pConfig_timezone);
$month newDate"m"$raids['start_time'], $pConfig_timezone );
$day newDate"d"$raids['start_time'], $pConfig_timezone );
$today_month newDate"m"time(), $pConfig_timezone );
$today_day newDate"d"time(), $pConfig_timezone );
$today "";
$timedone $raids['start_time'] + $time_buffer;
$hour gmdate"H"$raids['start_time'] );
$suffix="";
if($hour 12){
$hour $hour 12;
$suffix "pm";
}else {
$suffix "am";
}
$mins gmdate"i"$raids['start_time'] );
$hour2 gmdate"H:i"$rightnow );
$hour3 gmdate"H:i"$timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day && 
    $raids['start_time'] < $rightnow && $rightnow $timedone) {
$today "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(CST): {$raids['location']}</a>{$today}</span><br>";

   
$activeu .= $link." ";
}
if ( $totalraids ==  0){
$activeu "No upcoming raids.   ";
}
$activeu substr($activeu0, (strlen($activeu) -2));
$content "
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">
$totalraids</span> <b>Raid(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"
$this->images/atb_chat.gif\" style=\"vertical-align: middle;\" alt=\"\" />&nbsp;<a class=\"uno\" href=\"http://www.nethergard.com/phpraider/index.php\">Raid Calendar</a>
  </td>
</tr>            
        "
;


unset($totalraids);
unset($rootlink);
unset($rightnow);

?>

Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 02:22:15 AM
//$DB->query("DELETE FROM mkp_chat WHERE run_time < ".$dead_users." ");
$DB->query("SELECT raid_id, location, start_time, raid_leader FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC ");


this part here, have you created this in your database and if so what parameters?
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 02:26:54 AM
I am sorry, that part is not needed.  ???
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 02:28:49 AM
than how are you storing the data?
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 02:29:42 AM
The data is stored in the smf database. I don't think anything special was done.
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 02:31:04 AM
its cool, if you give me the database parameters will fix ya up.
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 02:34:02 AM
Quote from: StormLrdâ„¢ on June 05, 2007, 02:31:04 AM
its cool, if you give me the database parameters will fix ya up.

ok I am php and msql challanged, what do you mean by parameters?
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 02:38:28 AM
i need to know how you set the table up for this in the database, what its name is, what variables you added to it inorder to setup the call to retreive this data for your function to work.
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 02:47:07 AM
You mean the database name?
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 02:58:55 AM
yes and the variables in it.
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 03:05:21 AM
Database name is  ngwforums         


          phpraider_announcements
           phpraider_attribute 
           phpraider_attribute_data
           phpraider_character
           phpraider_class
           phpraider_definitions
           phpraider_gender
           phpraider_groups
           phpraider_guild
           phpraider_permissions
           phpraider_profile
           phpraider_race
           phpraider_raid
           phpraider_raid_limits
           phpraider_raid_templates
           phpraider_role
           phpraider_signups
           phpraider_subclass
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 03:16:32 AM
<?php
$rootlink 
"http://www.nethergard.com/phpraider/index.php?option=com_view&id";

function 
newDate$format$timestamp$tz ) {
$offset = (60 60) * ($tz 100); // Seconds from GMT
    
$timestamp $timestamp $offset;
    return 
gmdate$format$timestamp );
}

if (!
defined("IN_MKP")) {
    die (
"Sorry !! You cannot access this file directly.");
}
$content "";
$pConfig_timezone = -500;
$offset = (60 60) * ($pConfig_timezone/100);
$time_buffer = (60 60) * 2;  
$rightnow time() + $offset;
$future $rightnow $time_buffer;

global 
$db_prefix$scripturl$txt,$settings,$modSettings$sourcedir;


$DB->query("SELECT raid_id, location, start_time, raid_leader FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC "__FILE____LINE__);

$sep ",";
$totalraids $DB->get_num_rows();


while ($raids $DB->fetch_row()) {
$year newDate"Y"$raids['start_time'], $pConfig_timezone);
$month newDate"m"$raids['start_time'], $pConfig_timezone );
$day newDate"d"$raids['start_time'], $pConfig_timezone );
$today_month newDate"m"time(), $pConfig_timezone );
$today_day newDate"d"time(), $pConfig_timezone );
$today "";
$timedone $raids['start_time'] + $time_buffer;
$hour gmdate"H"$raids['start_time'] );
$suffix="";
if($hour 12){
$hour $hour 12;
$suffix "pm";
}else {
$suffix "am";
}
$mins gmdate"i"$raids['start_time'] );
$hour2 gmdate"H:i"$rightnow );
$hour3 gmdate"H:i"$timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day && 
    $raids['start_time'] < $rightnow && $rightnow $timedone) {
$today "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(CST): {$raids['location']}</a>{$today}</span><br>";

   
$activeu .= $link." ";
}
if ( $totalraids ==  0){
$activeu "No upcoming raids.   ";
}
$activeu substr($activeu0, (strlen($activeu) -2));
$content "
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">
$totalraids</span> <b>Raid(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"
$this->images/atb_chat.gif\" style=\"vertical-align: middle;\" alt=\"\" />&nbsp;<a class=\"uno\" href=\"http://www.nethergard.com/phpraider/index.php\">Raid Calendar</a>
  </td>
</tr>            
        "
;


unset($totalraids);
unset($rootlink);
unset($rightnow);

?>


that should work other than the images, you'll need to set the path for any of those.
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 03:17:13 AM
Thank You StormLrd, your a prince  ;)
Title: Re: TP and phpraider block
Post by: stormlrd on June 05, 2007, 03:17:42 AM
welcome, and im not positive but i believe it iwll work.
Title: Re: TP and phpraider block
Post by: rebelrose on June 05, 2007, 03:19:45 AM
Thanks will let you know if not  :)
Title: Re: TP and phpraider block
Post by: djuplift on June 06, 2007, 03:30:42 PM
So here is the original code and here is the modified working code, but its working with most of the original functionality missing not sure what AJ has done.

Original code
<?php

$rootlink 
"http://www.wowsovguard.com/phpraider/index.php?option=com_view&id";

function 
newDate$format$timestamp$tz ) {
$offset = (60 60) * ($tz 100); // Seconds from GMT
    
$timestamp $timestamp $offset;
    return 
gmdate$format$timestamp );
}

if (!
defined("IN_MKP")) {
    die (
"Sorry !! You cannot access this file directly.");
}
$content "";
$pConfig_timezone = -500;
$offset = (60 60) * ($pConfig_timezone/100);
$time_buffer = (60 60) * 2;  
$rightnow time() + $offset;
$future $rightnow $time_buffer;


//$DB->query("DELETE FROM mkp_chat WHERE run_time < ".$dead_users." ");
$DB->query("SELECT raid_id, location, start_time, raid_leader FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC ");

$sep ",";
$totalraids $DB->get_num_rows();


while ($raids $DB->fetch_row()) {
$year newDate"Y"$raids['start_time'], $pConfig_timezone);
$month newDate"m"$raids['start_time'], $pConfig_timezone );
$day newDate"d"$raids['start_time'], $pConfig_timezone );
$today_month newDate"m"time(), $pConfig_timezone );
$today_day newDate"d"time(), $pConfig_timezone );
$today "";
$timedone $raids['start_time'] + $time_buffer;
$hour gmdate"H"$raids['start_time'] );
$suffix="";
if($hour 12){
$hour $hour 12;
$suffix "pm";
}else {
$suffix "am";
}
$mins gmdate"i"$raids['start_time'] );
$hour2 gmdate"H:i"$rightnow );
$hour3 gmdate"H:i"$timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day && 
    $raids['start_time'] < $rightnow && $rightnow $timedone) {
$today "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(CST): {$raids['location']}</a>{$today}</span><br>";

   
$activeu .= $link." ";
}
if ( $totalraids ==  0){
$activeu "No upcoming raids.   ";
}
$activeu substr($activeu0, (strlen($activeu) -2));
$content "
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">
$totalraids</span> <b>Raid(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"
$this->images/atb_chat.gif\" style=\"vertical-align: middle;\" alt=\"\" />&nbsp;<a class=\"uno\" href=\"http://www.wowsovguard.com/phpraider/index.php\">Raid Calendar</a>
  </td>
</tr>            
        "
;


unset($totalraids);
unset($rootlink);
unset($rightnow);

?>



Edited not functioning properly code:
// number of news items you want displaying
$feed_limit = 5;
$offset = 50; // find first space after this many chars and return result.

$stylesheet = '../raidfeed.css'; // stylesheet to use

$feed = 'http://www.nethergard.com/phpraider/index.php?option=com_rss&task=raid';   

ini_set('allow_url_fopen', true);
$fp = fopen($feed, 'r');
$xml = '';

while (!feof($fp))
{
   $xml .= fread($fp, 128);
}

fclose($fp);

function untag($string, $tag)
{
   $tmpval = array();
   $preg = "|<$tag>(.*?)</$tag>|is";

   preg_match_all($preg, $string, $tags);

   foreach ($tags[1] as $tmpcont)
   {
      $tmpval[] = $tmpcont;
   }

   return $tmpval;
}

$items = untag($xml, 'item');
$output = '<html>';
$output .= '<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
$output .= '<title></title>';
$output .= '<link href="' . $stylesheet . '" rel="stylesheet" type="text/css">';
$output .= '</head><body>';

$output .= '<font face="verdana" size="1">';
$html = '';

$id=0;

foreach ($items as $item)
{
   $title = untag($item, 'title');

   $link = untag($item, 'link'); 

   $when = untag($item, 'when');

   $descr = untag($item, 'description');

   $html .= '<div class="genmed">';
   $html .= 'Ã,» ' . '<a href="' . $link[0] . '" target="_new">' . $title[0] . '</a>' . ' on ' . $when[0] . '</div>';

   $id++;
   
   if($id == $feed_limit)
   {
      break;
   }
}


$output .= $html;
$output .= '</font>';
$output .= '</body></html>';

echo $output;
?>


So whats missing is its querying for all raids not just upcoming raids, its posting expired raids not upcomign raids, the original text formatting is missing (large red text) the flashing today, in progress functionality is missing as well.  Please take a look at this thread  http://www.wowsovguard.com/smf/index.php?topic=818.0 2 pages.. I am the GM And Admin of the website this is being made for btw. I would really like to get this functioning just as they do (http://www.wowsovguard.com/index.php I want it exactly like that.

EDIT: here is our website so you can see how it currently working and how it looks. www.nethergard.com
Title: Re: TP and phpraider block
Post by: purrfektphlaw on August 07, 2007, 10:45:31 PM
Below is the code I copied off of this site with only the minor modifications to the url and switched raid_leader/start_time.  I have just enough knowledge of php to make minor modifications, but that is really all, if you can point me in the right direction it would be much appreciated.

I am using:
TP 0.9.8
SMF 1.1.3
phpRaider 1.0.2
Linux server
MySQL 5.0

I have scoured the phpRaider forums, but they only appear to have the MKPortal code.  As of yet I have not been able to get this code to work properly.  I have also reviewed all the information in this board and did not seem to find anything that would help me to correct the problem I am having.

I recieve the message "Sorry !! You cannot access this file directly."

My phpraider_ is located in the same database as my smf_.


$rootlink = "http://www.vae-victis-guild.com/phpraider/index.php?option=com_view&id";

function newDate( $format, $timestamp, $tz ) {
$offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}

if (!defined("IN_MKP")) {
    die ("Sorry !! You cannot access this file directly.");
}
$content = "";
$pConfig_timezone = -500;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2; 
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

global $db_prefix,$scripturl,$txt,$settings,$modSettings, $sourcedir;


$DB->query("SELECT raid_id, location, raid_leader, start_time FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC ", __FILE__, __LINE__);

$sep = ",";
$totalraids = $DB->get_num_rows();


while ($raids = $DB->fetch_row()) {
$year = newDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = newDate( "m", $raids['start_time'], $pConfig_timezone );
$day = newDate( "d", $raids['start_time'], $pConfig_timezone );
$today_month = newDate( "m", time(), $pConfig_timezone );
$today_day = newDate( "d", time(), $pConfig_timezone );
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "<span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "<span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(CST): {$raids['location']}</a>{$today}</span><br>";

    $activeu .= $link." ";
}
if ( $totalraids ==  0){
$activeu = "No upcoming raids.";
}
$activeu = substr($activeu, 0, (strlen($activeu) -2));
$content = "
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">$totalraids</span> <b>Raid(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <a class=\"uno\" href=\"http://www.vae-victis-guild.com/phpraider/index.php\">Raid Calendar</a>
  </td>
</tr>           
      ";


unset($totalraids);
unset($rootlink);
unset($rightnow);
Title: Re: TP and phpraider block
Post by: Thurnok on August 12, 2007, 07:31:31 AM
Try changing this:

if (!defined("IN_MKP")) {
    die ("Sorry !! You cannot access this file directly.");
}


to this:

if (!defined("SMF")) {
    die ("Sorry !! You cannot access this file directly.");
}
Title: Re: TP and phpraider block
Post by: Omniverse on August 12, 2007, 09:38:21 PM
Ok, I am trying this as well.

I put the code exampled here into a php block, I can't get it to work however.

I get the following error:

Fatal error: Call to a member function query() on a non-object

Code used, any ideas?



$rootlink = "http://ksguild.org/phpraider/wow/index.php?option=com_view&id";

function newDate( $format, $timestamp, $tz ) {
$offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}

if (!defined("SMF")) {
    die ("Sorry !! You cannot access this file directly.");
}
$content = "";
$pConfig_timezone = -500;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2; 
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

global $db_prefix, $scripturl, $txt,$settings,$modSettings, $sourcedir;


$DB->query("SELECT raid_id, location, start_time, raid_leader FROM Wphpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC ", __FILE__, __LINE__);

$sep = ",";
$totalraids = $DB->get_num_rows();


while ($raids = $DB->fetch_row()) {
$year = newDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = newDate( "m", $raids['start_time'], $pConfig_timezone );
$day = newDate( "d", $raids['start_time'], $pConfig_timezone );
$today_month = newDate( "m", time(), $pConfig_timezone );
$today_day = newDate( "d", time(), $pConfig_timezone );
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(CST): {$raids['location']}</a>{$today}</span><br>";

    $activeu .= $link." ";
}
if ( $totalraids ==  0){
$activeu = "No upcoming raids.   ";
}
$activeu = substr($activeu, 0, (strlen($activeu) -2));
$content = "
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">$totalraids</span> <b>Raid(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"$this->images/atb_chat.gif\" style=\"vertical-align: middle;\" alt=\"\" />&nbsp;<a class=\"uno\" href=\"http://ksguild.org/phpraider/wow/index.php\">Raid Calendar</a>
  </td>
</tr>           
      ";


unset($totalraids);
unset($rootlink);
unset($rightnow);




Found this bit.. got it to work kinda... has issues with being centered in the block, also has an issue with the database.



$rootlink = "http://ksguild.org/phpraider/wow/index.php?option=com_view&id";

function raidernewDate( $format, $timestamp, $tz ) {
$offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}

$content = "";
$pConfig_timezone = -400;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2; 
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

global $db_prefix, $scripturl, $txt,$settings,$modSettings, $sourcedir;


$query = db_query("SELECT raid_id, location, start_time, raid_leader FROM Wphpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC",  __FILE__, __LINE__);

$sep = ",";
$totalraids = 0;


while ($raids = mysql_fetch_assoc($query)) {
$year = raidernewDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = raidernewDate( "m", $raids['start_time'], $pConfig_timezone );
$day = raidernewDate( "d", $raids['start_time'], $pConfig_timezone );
$today_month = raidernewDate( "m", time(), $pConfig_timezone );
$today_day = raidernewDate( "d", time(), $pConfig_timezone );
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow; font-size: 12px;'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(EST): {$raids['location']}</a>{$today}</span><br>
";

    $activeu .= $link." ";
$totalraids = $totalraids + 1;
}
if ( $totalraids ==  0){
$activeu = "No upcoming raids.   ";
}
$activeu = substr($activeu, 0, (strlen($activeu) -2));
$myhtml = "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">

</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">

  </td>
</tr>
</table>
      ";

echo itemstats_parse($myhtml);
unset($totalraids);
unset($rootlink);
unset($rightnow);



This line here causes an error for a duplicarte entry... sometimes. If I remove it, it stops working though.

echo itemstats_parse($myhtml);
Title: Re: TP and phpraider block
Post by: purrfektphlaw on August 14, 2007, 09:49:35 AM
Quote from: Thurnok on August 12, 2007, 07:31:31 AM
Try changing this:

if (!defined("IN_MKP")) {
    die ("Sorry !! You cannot access this file directly.");
}


to this:

if (!defined("SMF")) {
    die ("Sorry !! You cannot access this file directly.");
}


I tried that and still recieved the same error message.  I also tried this code:


$rootlink = "http://vae-victis-guild.com/phpraider/index.php?option=com_view&id";

function raidernewDate( $format, $timestamp, $tz ) {
$offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}

$content = "";
$pConfig_timezone = -400;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2; 
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

global $db_prefix, $scripturl, $txt,$settings,$modSettings, $sourcedir;


$query = db_query("SELECT raid_id, location, start_time, raid_leader FROM Wphpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC",  __FILE__, __LINE__);

$sep = ",";
$totalraids = 0;


while ($raids = mysql_fetch_assoc($query)) {
$year = raidernewDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = raidernewDate( "m", $raids['start_time'], $pConfig_timezone );
$day = raidernewDate( "d", $raids['start_time'], $pConfig_timezone );
$today_month = raidernewDate( "m", time(), $pConfig_timezone );
$today_day = raidernewDate( "d", time(), $pConfig_timezone );
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow; font-size: 12px;'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(EST): {$raids['location']}</a>{$today}</span><br>
";

    $activeu .= $link." ";
$totalraids = $totalraids + 1;
}
if ( $totalraids ==  0){
$activeu = "No upcoming raids.   ";
}
$activeu = substr($activeu, 0, (strlen($activeu) -2));
$myhtml = "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">

</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">

  </td>
</tr>
</table>
      ";

echo itemstats_parse($myhtml);
unset($totalraids);
unset($rootlink);
unset($rightnow);


but I recieve this message:

Fatal error: Cannot redeclare raidernewdate() (previously declared in /home/content/n/v/a/nvanwyck/html/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code:3) in /home/content/n/v/a/nvanwyck/html/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 3


??? not to sure where else to go, the phpraider site has pretty much the same coding and i've used all the info I could from there.

Thanks!
Title: Re: TP and phpraider block
Post by: Omniverse on August 14, 2007, 06:36:23 PM
For the code I posted, ya need to change one other bit.



$query = db_query("SELECT raid_id, location, start_time, raid_leader FROM Wphpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC",  __FILE__, __LINE__);



In there ya need to change the Wphpraider_raid to your mysql prefix, prolly just without the W. I use multiple ones for different games, so I change the prefix. :)
Title: Re: TP and phpraider block
Post by: Phinhead54 on August 20, 2007, 09:13:46 PM
Quote from: purrfektphlaw on August 14, 2007, 09:49:35 AM
Quote from: Thurnok on August 12, 2007, 07:31:31 AM
Try changing this:

if (!defined("IN_MKP")) {
    die ("Sorry !! You cannot access this file directly.");
}


to this:

if (!defined("SMF")) {
    die ("Sorry !! You cannot access this file directly.");
}


I tried that and still recieved the same error message.  I also tried this code:


$rootlink = "http://vae-victis-guild.com/phpraider/index.php?option=com_view&id";

function raidernewDate( $format, $timestamp, $tz ) {
$offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}

$content = "";
$pConfig_timezone = -400;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2; 
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

global $db_prefix, $scripturl, $txt,$settings,$modSettings, $sourcedir;


$query = db_query("SELECT raid_id, location, start_time, raid_leader FROM Wphpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC",  __FILE__, __LINE__);

$sep = ",";
$totalraids = 0;


while ($raids = mysql_fetch_assoc($query)) {
$year = raidernewDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = raidernewDate( "m", $raids['start_time'], $pConfig_timezone );
$day = raidernewDate( "d", $raids['start_time'], $pConfig_timezone );
$today_month = raidernewDate( "m", time(), $pConfig_timezone );
$today_day = raidernewDate( "d", time(), $pConfig_timezone );
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "     <span style='color:blue'><blink>(IN PROGRESS)</blink></span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:yellow; font-size: 12px;'> {$month}/{$day} - <a class=\"sg\" href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(EST): {$raids['location']}</a>{$today}</span><br>
";

   $activeu .= $link." ";
$totalraids = $totalraids + 1;
}
if ( $totalraids ==  0){
$activeu = "No upcoming raids.   ";
}
$activeu = substr($activeu, 0, (strlen($activeu) -2));
$myhtml = "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">

</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">

  </td>
</tr>
</table>
     ";

echo itemstats_parse($myhtml);
unset($totalraids);
unset($rootlink);
unset($rightnow);


but I recieve this message:

Fatal error: Cannot redeclare raidernewdate() (previously declared in /home/content/n/v/a/nvanwyck/html/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code:3) in /home/content/n/v/a/nvanwyck/html/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 3


??? not to sure where else to go, the phpraider site has pretty much the same coding and i've used all the info I could from there.

Thanks!

I'm getting the same error here, can't for the life of me figure it out.  I'd love to get this working though.
Title: Re: TP and phpraider block
Post by: Omniverse on August 23, 2007, 06:55:23 PM
Ok, here is one I got working, found from spiffy's site.



$rootlink = "your link to phpraider/index.php?option=com_view&id";

function raidernewDate( $format, $timestamp, $tz ) {
$offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}

$maxraids = 5;
$content = "";
$pConfig_timezone = -800;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2;
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

global $db_prefix, $scripturl, $txt,$settings,$modSettings, $sourcedir;

        $result = mysql_query("SELECT raid_id, location, start_time, raid_leader  FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC");
$sep = ",";
$totalraids = 0;


while ($raids = mysql_fetch_assoc($result)) {

$year = raidernewDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = raidernewDate( "m", $raids['start_time'], $pConfig_timezone );
$day = raidernewDate( "d", $raids['start_time'], $pConfig_timezone );
$today_month = raidernewDate( "m", time(), $pConfig_timezone );
$today_day = raidernewDate( "d", time(), $pConfig_timezone );

if($totalraids >= $maxraids) continue;
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "     <span style='color:blue'>(IN PROGRESS)</span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:red'> {$month}/{$day} - <a href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(PST): {$raids['location']}</a>{$today}</span><br>";

    $activeu .= $link." ";
$totalraids = $totalraids + 1;
}
if ( $totalraids ==  0){
$activeu = "No upcoming events.   ";
}
$activeu = substr($activeu, 0, (strlen($activeu) -2));
$myhtml = "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">$totalraids</span> <b>Event(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"http://your link to phpraider/templates/default/images/icons/icon_signed_up.png\" style=\"vertical-align: middle;\" alt=\"\" /> <a class=\"uno\" href=\"your link to phpraider\">Event Calendar</a>
  </td>
</tr>
</table>
      ";

echo $myhtml;
unset($totalraids);
unset($rootlink);
unset($rightnow);





Remember to edit the URL's. :)
Title: Re: TP and phpraider block
Post by: Phinhead54 on August 23, 2007, 08:01:08 PM
Looks great, the code doesn't error, I'm just trying to get it to pull the info from a database different then the smf database ... any ideas?  I've done it before, just trying to remember how to do it again :)
Title: Re: TP and phpraider block
Post by: Hakker on November 11, 2007, 11:07:42 PM
Quote from: Phinhead54 on August 23, 2007, 08:01:08 PM
Looks great, the code doesn't error, I'm just trying to get it to pull the info from a database different then the smf database ... any ideas?  I've done it before, just trying to remember how to do it again :)
I got the same problem I have phpraider stored in a different database so it doesn't really work then :(
Title: Re: TP and phpraider block
Post by: microbone on November 29, 2007, 11:12:48 AM
Some of you guys know how to make it look like the one on this site:
here (http://www.judeanpeoplesfront.net/forums/) (right panel)

it simply looks nice
Title: Re: TP and phpraider block
Post by: Hakker on December 07, 2007, 03:02:58 PM
Quote from: Omniverse on August 23, 2007, 06:55:23 PM
Ok, here is one I got working, found from spiffy's site.



$rootlink = "your link to phpraider/index.php?option=com_view&id";

function raidernewDate( $format, $timestamp, $tz ) {
$offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}

$maxraids = 5;
$content = "";
$pConfig_timezone = -800;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2;
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

global $db_prefix, $scripturl, $txt,$settings,$modSettings, $sourcedir;

        $result = mysql_query("SELECT raid_id, location, start_time, raid_leader  FROM phpraider_raid WHERE start_time > ".$future." ORDER BY start_time ASC");
$sep = ",";
$totalraids = 0;


while ($raids = mysql_fetch_assoc($result)) {

$year = raidernewDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = raidernewDate( "m", $raids['start_time'], $pConfig_timezone );
$day = raidernewDate( "d", $raids['start_time'], $pConfig_timezone );
$today_month = raidernewDate( "m", time(), $pConfig_timezone );
$today_day = raidernewDate( "d", time(), $pConfig_timezone );

if($totalraids >= $maxraids) continue;
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
//echo "{$hour} {$hour2} {$hour3} -";
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "     <span style='color:blue'>(IN PROGRESS)</span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "     <span style='color:green'><blink>(TODAY)</blink></span>";
}
$link ="<span style='color:red'> {$month}/{$day} - <a href=\"$rootlink={$raids['raid_id']}\">{$hour}:{$mins}{$suffix}(PST): {$raids['location']}</a>{$today}</span><br>";

    $activeu .= $link." ";
$totalraids = $totalraids + 1;
}
if ( $totalraids ==  0){
$activeu = "No upcoming events.   ";
}
$activeu = substr($activeu, 0, (strlen($activeu) -2));
$myhtml = "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">$totalraids</span> <b>Event(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"http://your link to phpraider/templates/default/images/icons/icon_signed_up.png\" style=\"vertical-align: middle;\" alt=\"\" /> <a class=\"uno\" href=\"your link to phpraider\">Event Calendar</a>
  </td>
</tr>
</table>
      ";

echo $myhtml;
unset($totalraids);
unset($rootlink);
unset($rightnow);





Remember to edit the URL's. :)
Well it shows something but not my raids... It keeps standing on 0 :(
Title: Re: TP and phpraider block
Post by: hebxi1 on December 16, 2007, 07:00:31 AM
block code works nicely, but I also have my phpRaider info in a separate DB so it's just not pulling the right info ... if someone could tweak this code to work for either/or that would simply be awesome.
Title: Re: TP and phpraider block
Post by: laric on January 26, 2008, 10:26:55 AM
Here is my current phpraider block.

$rootlink = "http://your link to phpraider/index.php?option=com_view&id";

function raidernewDate( $format, $timestamp, $tz ) {
    $offset = (60 * 60) * ($tz / 100); // Seconds from GMT
    $timestamp = $timestamp + $offset;
    return gmdate( $format, $timestamp );
}
$activeu = "";
$maxraids = 5;
$content = "";
$pConfig_timezone = -500;
$offset = (60 * 60) * ($pConfig_timezone/100);
$time_buffer = (60 * 60) * 2;
$rightnow = time() + $offset;
$future = $rightnow - $time_buffer;

$phpraider_prefix = 'phpraider_';

global $db_prefix, $scripturl, $txt,$settings,$modSettings, $sourcedir;

$link = mysql_connect('your raid db host', 'your raid db user', 'your raid db pass');
if (!$link) {
    die('Not connected : ' . mysql_error());
}

$db_selected = mysql_select_db('your raid db', $link);
if (!$db_selected) {
    die ('Can\'t use phpraider : ' . mysql_error());
}


$result = mysql_query("SELECT t1.raid_id, location, start_time, raid_leader,IFNULL(antall,0) as antall,maximum,IFNULL(queue,0) as queue,icon_name  FROM phpraider_raid as t1 left join (SELECT `raid_id`,count(*) as antall FROM `phpraider_signups` where `cancel`=0 and `queue`=0 group by `raid_id`) as t2 on t1.raid_id=t2.raid_id left join (SELECT `raid_id`,count(*) as queue FROM `phpraider_signups` where `cancel`=0 and `queue`=1 group by `raid_id`) as t3 on t1.raid_id=t3.raid_id WHERE start_time > ".$future." ORDER BY start_time ASC");
$sep = ",";
$totalraids = 0;

while ($raids = mysql_fetch_assoc($result)) {
$year = raidernewDate( "Y", $raids['start_time'], $pConfig_timezone);
$month = raidernewDate( "m", $raids['start_time'], $pConfig_timezone );
$day = raidernewDate( "d", $raids['start_time'], $pConfig_timezone );
$daystr = raidernewDate( "D", $raids['start_time'], $pConfig_timezone );

$today_month = raidernewDate( "m", time(), $pConfig_timezone );
$today_day = raidernewDate( "d", time(), $pConfig_timezone );

$udda="";
       if(($totalraids+2)%2) $udda="2";
       if($totalraids >= $maxraids) continue;
$today = "";
$timedone = $raids['start_time'] + $time_buffer;
$hour = gmdate( "H", $raids['start_time'] );
$suffix="";
$mins = gmdate( "i", $raids['start_time'] );
$hour2 = gmdate( "H:i", $rightnow );
$hour3 = gmdate( "H:i", $timedone );
        $link ="
          <table width=\"175\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"29\" rowspan=\"3\" valign=\"top\">
          <div align=\"center\"><span><img src=\"http://your link to phpraider/games/WoW/images/raids/{$raids['icon_name']}\"/></span></div></td>
          <td width=\"175\" height=\"10\" valign=\"top\"><a href=\"$rootlink={$raids['raid_id']}\"><b>{$raids['location']}</b></a><br /> <span><a href=\"$rootlink={$raids['raid_id']}\">{$raids['antall']}/{$raids['maximum']}({$raids['queue']})  RL: {$raids['raid_leader']}</a></span><br/><a href=\"$rootlink={$raids['raid_id']}\">{$daystr} {$month}/{$day} {$hour}:{$mins}{$suffix}</a></td>
          </tr>
          </table>";
        $activeu .= $link."\n";
$totalraids = $totalraids + 1;
}
if ( $totalraids ==  0){
$activeu = "No upcoming events.   ";
}
$myhtml = "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
  <td width=\"100%\">
    <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
      <tr>
<td class=\"tdblock\">
<span class=\"mktxtcontr\">$totalraids</span> <b>Event(s)</b>
</td>
      </tr>
      <tr>
<td class=\"tdglobal\">
$activeu
</td>
      </tr>
    </table>
  </td>
</tr>
<tr>
  <td class=\"tdblock\">
  <img src=\"http://your link to phpraider/templates/default/images/icons/icon_signed_up.png\" style=\"vertical-align: middle;\" alt=\"\" /> <a href=\"your link to phpraider\">Event Calendar</a>
  </td>
</tr>
</table>
";
echo $activeu;
unset($totalraids);
unset($rootlink);
unset($rightnow);

Title: Re: TP and phpraider block
Post by: Omniverse on January 26, 2008, 04:19:38 PM
That works perfect Laric. :) Thank you.

2 questions...

How can I get the event calendar link to show back up? Was a link at the bottom of the block to phpraider. Looks like the code is there, but doesn't do it.

How do I change from 24 hour clock to 12 hour clock?
Title: Re: TP and phpraider block
Post by: microbone on January 30, 2008, 10:45:19 AM
before:

$hour2 = gmdate( "H:i", $rightnow );

insert this:

if($hour > 12){
$hour = $hour - 12;
$suffix = "pm";
}else {
$suffix = "am";
}


then you´ll get 12 hour showings..

the thing isn´t showing correctly because

echo $activeu <------;
unset($totalraids);
unset($rootlink);
unset($rightnow);


needs to be changed to:
echo $myhtml;

finally I did like the "in progress" "today" feature....
so if you want that back

after:
$hour3 = gmdate( "H:i", $timedone );

insert
if( $today_month == $month && $today_day == $day &&
    $raids['start_time'] < $rightnow && $rightnow < $timedone) {
$today = "     <span style='color:blue'>(Now)</span>";
} elseif( $today_month == $month && $today_day == $day ) {
$today = "     <span style='color:grey'><blink>Today</blink></span>";
}


change:
<table width=\"175\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"29\" rowspan=\"3\" valign=\"top\">
          <div align=\"center\"><span><img src=\"http://www.microbone.dk/raid/games/WoW/images/raids/{$raids['icon_name']}\"/></span></div></td>
          <td width=\"175\" height=\"10\" valign=\"top\"><a href=\"$rootlink={$raids['raid_id']}\"><b>{$raids['location']}</b></a><br /> <span><a href=\"$rootlink={$raids['raid_id']}\">{$raids['antall']}/{$raids['maximum']}({$raids['queue']})  RL: {$raids['raid_leader']}</a></span><br/><a href=\"$rootlink={$raids['raid_id']}\">{$daystr} {$month}/{$day} {$hour}:{$mins}{$suffix}</a></td>
          </tr>
          </table>";


to:

<table width=\"175\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"29\" rowspan=\"3\" valign=\"top\">
          <div align=\"center\"><span><img src=\"http://www.microbone.dk/raid/games/WoW/images/raids/{$raids['icon_name']}\"/></span></div></td>
          <td width=\"175\" height=\"10\" valign=\"top\"><a href=\"$rootlink={$raids['raid_id']}\"><b>{$raids['location']}</b></a>{$today}<br /> <span><a href=\"$rootlink={$raids['raid_id']}\">{$raids['antall']}/{$raids['maximum']}({$raids['queue']})  RL: {$raids['raid_leader']}</a></span><br/><a href=\"$rootlink={$raids['raid_id']}\">{$daystr} {$month}/{$day} {$hour}:{$mins}{$suffix}</a></td>
          </tr>
          </table>";


but laric thnx a lot for your code, looks so nice :)

Now I have a question...

I would really like to somehow integrate theme so that whenever a new raid is listed it makes use of the theme paragraph/linebreak. Sorry not sure what´s it called but have attached a pic to show what i mean..

I now i have to work with windowbg reference but it simply wont do it or look right!

But I hope some of you can help explain how it´s done :)
Title: Re: TP and phpraider block
Post by: laric on January 30, 2008, 12:26:26 PM
I am probably gonna redo all of it to use css so it is looking better on any theme.

But I am really sucky at css. I still haven't found any good tutorial for css.
Title: Re: TP and phpraider block
Post by: microbone on January 30, 2008, 12:38:35 PM
same here i guess..... :)

but put a h. ruler inbetween maybe it gives a better overview..
<td width=\"175\" height=\"10\" valign=\"top\"><a href=\"$rootlink={$raids['raid_id']}\"><b>{$raids['location']}</b></a>{$today}<br/> <span><a href=\"$rootlink={$raids['raid_id']}\">{$raids['antall']}/{$raids['maximum']}({$raids['queue']})  RL: {$raids['raid_leader']}</a></span><br/><a href=\"$rootlink={$raids['raid_id']}\">{$daystr} {$month}/{$day} {$hour}:{$mins}{$suffix}</a><hr width=\"125\" align=\"left\"</td>