• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Modern AAC Page - Latest Deaths

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
This is a Latest Deaths page for Modern Aac.

dcv79u.jpg

How to include the page?

Go to this page http://127.0.0.1/index.php/admin/createPage

create a page latestdeaths
input there the code

PHP:
<?PHP
///////////////////////////
///    Deathlist Page   ///
///     By Kavvson      ///
///     Modern AAC      ///
///////////////////////////
/* Set the 
$config['site']['last_deaths_limit'] limit
in the  config.php file */
require ('config.php');
/* Connection */
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = POT::getInstance()->getDBHandle();
$players_deaths = $SQL->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`, `players`.`world_id` FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0,'.$config['site']['last_deaths_limit']);
$players_deaths_count = 0;
if(!empty($players_deaths))
{
 foreach($players_deaths as $death)
 {
  $players_deaths_count++;
  if(is_int($players_deaths_count / 2))
   $bgcolor = $config['site']['darkborder'];
  else
   $bgcolor = $config['site']['lightborder'];

  @$players_rows .= "<TR CLASS=\"".$bgcolor."\"><TD WIDTH=\"30\"><center>".$players_deaths_count.".</center></TD><TD WIDTH=\"125\"><small>".date("j.m.Y, G:i:s",$death['date'])."</small></TD><TD><a href=\"".WEBSITE."/index.php/character/view/".$death['name']."\"><b>".$death['name']."</b></a> ";
  $killers = $SQL->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists
FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id
LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id
WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll();

  $i = 0;
  $count = count($killers);
  foreach($killers as $killer)
  {
   $i++;
   if($killer['player_name'] != "")
   {
    if($i == 1)
     $players_rows .= "killed at level <b>".$death['level']."</b>";
    else if($i == $count)
     $players_rows .= " and";
    else
     $players_rows .= ",";

    $players_rows .= " by ";
    if($killer['monster_name'] != "")
     $players_rows .= $killer['monster_name']." summoned by ";

    if($killer['player_exists'] == 0)
     $players_rows .= "<a >";

    $players_rows .= $killer['player_name'];
    if($killer['player_exists'] == 0)
     $players_rows .= "</a>";
   }
   else
   {
    if($i == 1)
     $players_rows .= "died at level <b>".$death['level']."</b>";
    else if($i == $count)
     $players_rows .= " and";
    else
     $players_rows .= ",";

    $players_rows .= " by ".$killer['monster_name'];
   }
  }

  $players_rows .= ".</TD></TR>";
 }
}

if($players_deaths_count == 0)
 ECHO '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR CLASS="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Last Deaths</B></TD></TR><TR CLASS='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>No one died on '.$config['server_name'].'.</TD></TR></TABLE></TD></TR></TABLE><BR>';
else
 ECHO '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR CLASS="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Last Deaths</B></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>'.$players_rows.'</TABLE>';
?>
Then you can go into \templates\default and add somewhere in the menu
Code:
 <li><a href="{$path}/index.php/p/v/latestdeaths">Latest  Deaths</a></li>
Add in config.php

PHP:
/* Modifications */
/* Limits for latest deaths page*/
$config['site']['last_deaths_limit'] = 50;

/* Headers for latest deaths or other pages*/
$config['site']['darkborder'] = "darkBorder";
$config['site']['vdarkborder'] = "vdarkBorder";
$config['site']['lightborder'] = "lightBorder";
If you want the same effect go into \public\css

Add somewhere

PHP:
.lightBorder {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#EAD194 url(images/header-1.gif) repeat-x scroll center top;
}

.vdarkBorder {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#AA5900 url('images/header-3.gif') repeat-x scroll center top;
}

.darkBorder {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#DBB96A url(images/header-2.gif) repeat-x scroll center top;
}
Download the attach
images.rar (6.0 KB)

And extract in \public\css\images
Regards rep me :)
 

Attachments

Last edited by a moderator:
if(is_int($players_deaths_count / 2))
$bgcolor = $config['site']['darkborder'];

What is that?

First of all, in Modern AAC you don't have to do it like that, with jQuery u can get :eek:dd and :even and set class or anything for them.
 
Paxi im not that pro as you :) but :eek: believe me one example and i cant get it all out rofl
 
PHP:
/* Modifications */
/* Limits for latest deaths page*/
$config['site']['last_deaths_limit'] = 50;

/* Headers for latest deaths or other pages*/
$config['site']['darkborder'] = "darkBorder";
$config['site']['vdarkborder'] = "vdarkBorder";
$config['site']['lightborder'] = "lightBorder";

Is there some place else I can put this instead of config.php cuz otherwise I need manually add that each time a new rev comes out. Also It aint working for me I get errors.

PHP:
"; } } if($players_deaths_count == 0) ECHO '

$players_deaths_count = 0; if(!empty($players_deaths)) { foreach($players_deaths as $death) { $players_deaths_count++; if(is_int($players_deaths_count / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; @$players_rows .= "
".$players_deaths_count.".
	".date("j.m.Y, G:i:s",$death['date'])."	".$death['name']." "; $killers = >$SQL-query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id >ASC")-fetchAll(); $i = 0; $count = count($killers); foreach($killers as $killer) { $i++; if($killer['player_name'] != "") { if($i == 1) $players_rows .= "killed at level ".$death['level'].""; else if($i == $count) $players_rows .= " and"; else $players_rows .= ","; $players_rows .= " by "; if($killer['monster_name'] != "") $players_rows .= $killer['monster_name']." summoned by "; if($killer['player_exists'] == 0) $players_rows .= ""; $players_rows .= $killer['player_name']; if($killer['player_exists'] == 0) $players_rows .= ""; } else { if($i == 1) $players_rows .= "died at level ".$death['level'].""; else if($i == $count) $players_rows .= " and"; else $players_rows .= ","; $players_rows .= " by ".$killer['monster_name']; } } $players_rows .= ".
Last Deaths
No one died on '.$config['server_name'].'.

'; else ECHO '
Last Deaths
'.$players_rows.'
'; >?
 
Code:
$(document).ready(
	function()
	{
		$("ul li:odd").css("background-color: #ffffff");
		$("ul li:even").css("background-color: #000000");
	});
sample
 
:eek: nice averatec...

LeO, you can always do it below the
PHP:
<?PHP
tag (the config part)

Btw i have something for you all :) Modern_AAC.rar

might someone need : All guides + all modifications made by me :)
 
^^

$(document).ready(
function()
{
$("ul li:eek:dd").css("background-color: #ffffff");
$("ul li:even").css("background-color: #000000");
});

Is for <ul><li> tags is it also for <tr>? :) btw im still working on the auto complete of character_view :) paxi or aver you could help :( since all is good just the jquery part left
 
I think there is a bug in Modern AAC when I tried to create a page and pasted the php code in it. When I then went in to the new page I got that error I posted before.

But then I manually edited the page file with notepad++ And repasted the php code. It then worked.

Weird

By the way how can I change the colours of the ui in this? It doesnt suit the WoW template maybe you can make so it looks nice on it? Rep++ either way
 
Hmm dunno just find 3 images as a background for the table :)) very simple :]
 
^^



Is for <ul><li> tags is it also for <tr>? :) btw im still working on the auto complete of character_view :) paxi or aver you could help :( since all is good just the jquery part left

I said that it's sample :)
change
Code:
@$players_rows .= "<TR CLASS="".$bgcolor."\">...
to
Code:
@$players_rows .= "<TR CLASS="row_class">...
and change "ul li" to ".row_class tr"
and you must add .row_class to css file or only in this file...
 
Last edited:
I said that it's sample :)
change
Code:
@$players_rows .= "<TR CLASS=\"".$bgcolor."\">...
to
Code:
@$players_rows .= "<TR ID="row" CLASS=\"".$bgcolor."\">...
and change "ul li" to "tr#row"

class not ID, ID is unique and should be only one on page.

And there is known bug with editing, because when you edit the > character changes place for example with -> in OO. So it's better to manualy edit the file.
 
class not ID, ID is unique and should be only one on page.

And there is known bug with editing, because when you edit the > character changes place for example with -> in OO. So it's better to manualy edit the file.

sory I'm tired...
 
I said that it's sample :)
change
Code:
@$players_rows .= "<TR CLASS=\"".$bgcolor."\">...
to
Code:
@$players_rows .= "<TR ID="row" CLASS=\"".$bgcolor."\">...
and change "ul li" to "tr#row"

PHP:
<script>$(document).ready(
	function()
	{
		$("TR#row :odd").css("background-color: #ffffff");
		$("TR#row :even").css("background-color: #000000");
	});
</script>

Code:
 @$players_rows .= "<TR ID=\"row\" >

white :(
 
PHP:
<?php
	if(!defined('BASEPATH')) exit('No direct script access allowed');

	require("config.php");
	list($darkBg, $lightBg, $rows, $bgColor, $i, $killers) = array("#AABBCC", "#FFEEDD", 0, 0, 0, NULL);
	$ots = POT::getInstance();
	$ots->connect(POT::DB_MYSQL, connection());
	$SQL = $ots->getDBHandle();
	$deaths = $SQL->query("SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`, `players`.`world_id` FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `player_deaths`.`date` DESC LIMIT 0,{$config['latestdeathlimit']};");

	echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" width=\"100%\"><tr class=\"{$config['site']['vdarkborder']}\"><td class=\"white\"><b>Latest Deaths</b></td></tr>";

	if($deaths->rowCount())
	{
		echo "</table><table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" width=\"100%\">";
		foreach($deaths as $death)
		{
			$i = 0;
			$rows++;
			$bgColor = (is_int($rows / 2) ? $darkBg : $lightBg);
			$killers = $SQL->query("SELECT `environment_killers`.`name` AS `monster_name`, `players`.`name` AS `player_name`, `players`.`deleted` AS `player_exists`
				FROM `killers` LEFT JOIN `environment_killers` ON `killers`.`id` = `environment_killers`.`kill_id`
				LEFT JOIN `player_killers` ON `killers`.`id` = `player_killers`.`kill_id` LEFT JOIN `players` ON `players`.`id` = `player_killers`.`player_id`
				WHERE `killers`.`death_id` = {$SQL->quote($death['id'])} ORDER BY `killers`.`final_hit` DESC, `killers`.`id` ASC")->fetchAll();

			echo "<tr bgcolor=\"{$bgColor}\"><td width=\"30\"><center>{$rows}.</center></td><td width=\"125\"><small>".date("j.m.Y, G:i:s", $death['date'])."</small></td><td><a href=\"".WEBSITE."/index.php/character/view/{$death['name']}\"><b>{$death['name']}</b></a> ";

			foreach($killers as $killer)
			{
				$i++;
				if(!empty($killer['monster_name']))
					$killer['monster_name'] = (in_array($i, array(1, count($killers))) ? str_replace(array("an ", "a "), array("", ""), $killer['monster_name']) : $killer['monster_name']);

				echo (!empty($killer['player_name']) ? ($i == 1 ? "killed at level <b>{$death['level']}</b> by " : ($i == count($killers) ? " and by " : ", ")).(!empty($killer['monster_name']) ? "{$killer['monster_name']} summoned by " : "").($killer['player_exists'] == 0 ? "<a href=\"".WEBSITE."/index.php/character/view/{$killer['player_name']}\">{$killer['player_name']}</a>" : $killer['player_name']) : ($i == 1 ? "died at level <b>{$death['level']}</b> by {$killer['monster_name']}" : ($i == count($killers) ? " and by {$killer['monster_name']}" : ", {$killer['monster_name']}")));

			}
			
			echo ".</td></tr>";
		}
		
		echo "</table>";
	}
	else
		echo "<tr bgcolor=\"{$darkBg}\"><td><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr><td>No one died on {$config['server_name']}.</td></tr></table></td></tr></table>";
?>
 
Back
Top