Custom Block

Post Reply

Topic author
blackhex666
Active Member
Posts: 7
Joined: 13. November 2010 22:07
phpBB.de User: blackhex666
phpBB.com User: blackhex666

Custom Block

Post by blackhex666 »

Oke i created a block by copy paste a block in styles/prosilver/template/portal/block
i change it name to my custom name.
i added a line in styles/prosilver/template/portal/portal_right.html with the custom block name:

Code: Select all

<!-- INCLUDE portal/block/realm_onoff.html -->
And here is the code...Original is welcome.html

Code: Select all

<!--version $Id: welcome.html 521 2009-08-26 20:59:19Z christian_n $ //-->
{$C_BLOCK_H_L}<dt>{L_WELCOME}</dt>{$C_BLOCK_H_R}
	<div class="panel bg1" style="margin-bottom: 0px">
		<div class="inner"><span class="portal-corners-top-inner"></span>
			<div class="postbody" style="width: 100%">
				<div class="content">
				 
<?php
//noobish server settings
$sip = "127.0.0.1";
$sport = "3306"; 

if(realm_status($sip, $sport) === false)
{
echo "Server je<font color=red> Offline</font>"; // displayed text if offline(server je= server is) Offline will be red

}
elseif(realm_status($sip, $sport) === true)
{
echo "Server je <font color=green> OnLine" ; // displayed text if online(server je =server is) Onlne will be green
}
else
{
echo "Server je<font color=yellow> Nedostupný</font>"; // displayed text if unvailable (server je = server is)(Nedostupný= unvailable) Nedostupný will be yellow
}

function realm_status($host, $port)
{
error_reporting(0);
$etat = fsockopen($host,$port,$errno,$errstr,3);
if(!$etat){return false;}else{return true;}}

?>


<br>----</br>


<!-- Players online right now, horde, alli, all together -->
<?php
$host = "127.0.0.1";  //db host
$user = "root";       // username
$pass = "ascent";       // password
$char_data = "characters";  // Characters db

$conn = mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($char_data, $conn) or die(mysql_error());

// Every noob select
$sql = "SELECT SUM(online) FROM characters";
$sqlquery = mysql_query($sql) or die(mysql_error());
$memb = mysql_result($sqlquery,0,0);

// Alliance noobs select
$asql = "SELECT SUM(online) FROM characters WHERE race IN(1,3,4,7,11)";
$asqlquery = mysql_query($asql) or die(mysql_error());
$amemb = mysql_result($asqlquery,0,0);

// Horde noobs select
$hsql = "SELECT SUM(online) FROM characters WHERE race IN(2,5,6,8,10)";
$hsqlquery = mysql_query($hsql) or die(mysql_error());
$hmemb = mysql_result($hsqlquery,0,0);

echo "Dohromady - ".$memb."<br />"; // all noobs displayed text 
echo "Alliance - ".$amemb."<br />"; // alli noobs displayed text
echo "Horda - ".$hmemb."<br />"; //horde noobs displayed text
mysql_close($conn);
?>


<br>----</br>


<!-- total characters/noob's gfs in db ! -->
<?php
$host = "127.0.0.1";  //db host
$user = "root";       // username
$pass = "ascent";       // password
$logon = "characters";  // characters db
$porn = "realmd, auth";  // accounts db

$conn = mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($logon, $conn) or die(mysql_error());

// characters/noob's girlfriend select
$sql = "SELECT COUNT(*) FROM characters";
$sqlquery = mysql_query($sql) or die(mysql_error());
$char = mysql_result($sqlquery,0,0);

echo "All characters: " . $char .""; // displayed text for noobs gfs!
?>


<br>----</br>


<!-- All accs of all noobs in your noobish db! -->
<?php 
$host = "127.0.0.1";  //db host
$user = "root";       // username
$pass = "ascent";       // pass
$logon = "realmd,auth";  // acc db

$conn = mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($porn, $conn) or die(mysql_error());


// noob's acc select
$acct_sql = "SELECT COUNT(*) FROM account";
$acct_sqlquery = mysql_query($acct_sql) or die(mysql_error());
$acc = mysql_result($acct_sqlquery,0,0);

echo "All accounts: " . $acc . ""; // displayed text for all accs

mysql_close($conn);
?>

				</div>
			</div>
		<span class="portal-corners-bottom-inner"></span></div>
	</div>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}

Second. Original is online_friends.html
Third. Original is custom_small.html

but no one is working...:(They have the same code...but nothing it is not showing
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: Custom Block

Post by Marc »

PHP won't work inside HTML files. Also, the code you are using does not fit the phpBB Coding guidelines and would need to be rewritten in pretty much every part to work with phpBB3. Have you checked if something like you want already exists for phpBB3 as a MOD?
Post Reply

Return to “Modifications Support”