Brightside
Member
Hello, I'm trying to recreate this using PHP Callbacks and Templates. However, I'm unclear how to echo the data within the template.
My Callback
Template
CSS
My Callback
Code:
<?php
class bright_sa_sa
{
public static function serverteam(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
{
$con=mysqli_connect("127.0.0.1","XXXXXXX","XXXXXXX","XXXXXXX");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$jbstaff = mysqli_query($con,"SELECT * FROM sb_admins WHERE user LIKE '%Jail%' ORDER BY srv_group DESC");
$ttstaff = mysqli_query($con,"SELECT * FROM sb_admins WHERE user LIKE '%TTT%' ORDER BY srv_group DESC");
$ssstaff = mysqli_query($con,"SELECT * FROM sb_admins WHERE user LIKE '%Surf%' ORDER BY srv_group DESC");
while($jbsrow = mysqli_fetch_array($jbstaff))
{
$response->params['jb'] = '<div class="steamprofile" id="' . $jbsrow['srv_group'] . '" title="' . $jbsrow['authid'] . '"></div>';
}
while($ttsrow = mysqli_fetch_array($ttstaff))
{
$response->params['ttt'] = '<div class="steamprofile" id="' . $ttsrow['srv_group'] . '" title="' . $ttsrow['authid'] . '"></div>';
}
while($sssrow = mysqli_fetch_array($ssstaff))
{
$response->params['surf'] = '<div class="steamprofile" id="' . $sssrow['srv_group'] . '" title="' . $sssrow['authid'] . '"></div>';
}
mysqli_close($con);
$response->templateName = 'bright_serverteam';
}
}
?>
Template
Code:
<script src="XXXXXXX"></script>
<xen:require css="bright_serverteam.css" />
<div style="width: 250px">
<div id="global">
<center><span style="font-weight: 900; font-size: 26px">Global Admins</span></center>
<div class="steamprofile" id="Founder" title="STEAM_0:0:40515805"></div><!--Alvarez-->
<div class="steamprofile" id="Founder" title="MrBrightside1"></div><!--Bright-->
<div class="steamprofile" id="Founder" title="STEAM_0:0:29656095"></div><!--Hero-->
<div class="steamprofile" id="Founder" title="STEAM_0:1:31551356"></div><!--K0Killer-->
<div class="steamprofile" id="Captain" title="STEAM_0:1:44639895"></div><!--Circe-->
<div class="steamprofile" id="Captain" title="STEAM_0:1:33846347"></div><!--Forgot-->
<div class="steamprofile" id="Captain" title="STEAM_0:0:1241826"></div><!--Lemonz-->
<div class="steamprofile" id="Captain" title="STEAM_0:0:51633105"></div><!--Xearta-->
</div>
<hr />
<center>
<select id="serverlist">
<option value="jb">Jailbreak</option>
<option value="mg">Mini Games</option>
<option value="ttt">TTT</option>
<option value="ss">Skill Surf</option>
<option value="sel" selected>Select A Server</option>
</select>
</center>
<br />
<div id="jb">
<ol>
<xen:foreach loop="$jb" value="$jbadmins">
</xen:foreach>
</ol>
</div>
<div id="ttt">
<ol>
<xen:foreach loop="$ttt" value="$tttadmins">
</xen:foreach>
</ol>
</div>
<div id="surf">
<ol>
<xen:foreach loop="$surf" value="$surfadmins">
</xen:foreach>
</ol>
</div>
</div>
<script>
$(document).ready(function() {
$("#ttt, #jb, #surf, #minigames").css("display", "none");
});
</script>
<script>
$('#serverlist').change(function(){
if($('#serverlist').val() == 'jb'){
$('#ttt, #surf, #minigames').slideUp(500);
$('#jb').delay(501).slideDown(500);
}
else if($('#serverlist').val() == 'ttt'){
$('#jb, #surf, #minigames').slideUp(500);
$('#ttt').delay(501).slideDown(500);
}
else if($('#serverlist').val() == 'ss'){
$('#jb, #ttt, #minigames').slideUp(500);
$('#surf').delay(501).slideDown(500);
}
else if($('#serverlist').val() == 'mg'){
$('#jb, #ttt, #surf').slideUp(500);
$('#minigames').delay(501).slideDown(500);
}
else if($('#serverlist').val() == 'sel'){
$('#jb, #ttt, #surf, #minigames').slideUp(500);
}
});
</script>
Code:
#Founder {
max-width: 230px;
border-style: solid;
border-width: 2px;
border-color: rgba(255,132,0,.7); }
#Captain {
max-width: 230px;
border-style: solid;
border-width: 2px;
border-color: rgba(255,215,0,.7); }
#Manager {
max-width: 230px;
border-style: solid;
border-width: 2px;
border-color: rgba(168,0,255,.7); }
#Agent {
max-width: 230px;
border-style: solid;
border-width: 2px;
border-color: rgba(0,216,255,.7); }