View Full Version : How do I make php module move to center of page
gridirontalk
07-20-2004, 11:08 AM
I installed a php script and it is on the top of the page I cant get it to go to the center of page http://www.gridirontalk.com/cmps_index.php?page=casino-sportsbook-bonus The CMPS is calling the php script from the module folder
Can anyone give me any suggestions. Thanks in advance
Morrus
07-20-2004, 11:39 AM
The placement of modules is controlled from the admincp.
gridirontalk
07-20-2004, 11:42 AM
The placement of modules is controlled from the admincp.
I put it in the center but it still displays it up top
Brian
07-20-2004, 11:47 AM
This post (http://www.vbadvanced.com/forum/showthread.php?t=1337) may help you. :)
gridirontalk
07-20-2004, 01:02 PM
I am still lost because I dont really understand what he did.
gridirontalk
07-20-2004, 07:48 PM
Can anyone help me out I need to get this up. I will pay to get it done
KW802
07-20-2004, 10:31 PM
Can anyone help me out I need to get this up. I will pay to get it done
Let's start with the basics.... is the PHP code in question something that is OK to publicly post? If so post up the code here and and I'm sure one of us can hit it.
gridirontalk
07-21-2004, 08:35 AM
That is the code thats in the Module folder
<?
mysql_connect('localhost','gridiron_special','jjd$14X');
mysql_select_db('gridiron_special');
$c = -1;
$content .= "<table cellSpacing='0' cellPadding='1' width='100%' border='0'>\n";
$q = mysql_query("SELECT st.*,sn.Name FROM stores st,stores_names sn WHERE st.StoreID=sn.ID AND st.Approved=1 ORDER BY ID DESC LIMIT 0,10");
while($r=mysql_fetch_array($q)){
$c = $c * (-1);
if($c == 1){
$color= "bgColor='#eeeeee'";
}
else {
$color = "bgColor='#cccccc'";
}
if($r[Code]){
$r[Code] = '['.$r[Code].']';
}
$content .= "
<tr>
<td $color height='15'><b>
<span style='font-style:normal; font-variant:normal; font-size:10pt; font-family:arial'>$r[Name]</span><span style='FONT: 10pt arial'>-
<a href='$r[Url]' target='_blank'>$r[Title]</a></span></b></td>
</tr>
";
}
$content .= "</table>\n";
echo $content;
?>
KW802
07-21-2004, 09:17 AM
That is the code thats in the Module folder
OK, if my gray cells are working today (I'm back at work after a long weekend and no caffiene yet ;) )...
1. Create a new template to display the results of your module. In my case I created a generic one called "adv_portal_script_results" with the following code......
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat">
<span class="smallfont">
<strong>$vba_options[portal_blockbullet] $mods[title]</strong>
</span>
</td>
</tr>
<tr><td class="$getbgrow" width="100%">$content</td></tr>
</table>
<br />
2. Remove the "echo $content;" from your module
3. Add the following code to the top of your PHP module (right below the "<?" line....
// Start our object
ob_start();
4. Add the following code to the bottom of your PHP module (right above the "?>" line....
// End our object
ob_end_clean();
// Fetch the vBadvanced template to display the results
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_script_results') . '";');
5. Change your module to update the 'Templates' used.
6. Test & tweak as necessary.
7. Let me know if works (again, the gray cells aren't necessarily working yet today so I may have missed something).
:D
Brian
07-21-2004, 09:53 AM
An easier way... Just create the template as KW802 suggested, then remove the 'echo $content;' part from the bottom of the file and that should do the trick. :)
gridirontalk
07-21-2004, 09:59 AM
Seemd to have worked Thanks alot.
KW802
07-21-2004, 10:02 AM
An easier way... Just create the template as KW802 suggested, then remove the 'echo $content;' part from the bottom of the file and that should do the trick. :)
Would he then not need the code for the object start, object end, and the template fetch inside of the PHP? I thought the template fetch was needed in the PHP code in order to pass in the result of the variable from the PHP to the template. :confused:
Brian
07-21-2004, 10:04 AM
That should only be necessary when a lot of the content is echoed. Since all of the content is already put into a variable, then you don't really need the other coding. ;)
KW802
07-21-2004, 10:09 AM
That should only be necessary when a lot of the content is echoed. Since all of the content is already put into a variable, then you don't really need the other coding. ;)
That's good to know, thanks.
Hi im having the same problem. I tried the method above to no avail. Im using a php script that i placed in my module folder. Heres the code of the php page
<html>
<head>
<link rel="stylesheet" type="text/css" href="bnet.css">
</head>
<body bgcolor="#000000">
<center><table width="1%">
<tr>
<td>
<?php
include("show_ladder.php");
?>
</td>
</tr>
</table>
</center>
</body>
</html>
It keeps showing up on the top of the page above my portal. Heres an example http://www.clanggl.net/forum/index2.php?page=members
Someone please help.
Can anyone please help me out? :-\ :-\
Brian
07-24-2004, 12:59 PM
I'd need to see the code in "show_ladder.php" and the template you added.
Heres the code. And i used the template someone posted by KW802 .
<?php
// (c)2003 by zuLu.TrunkZ
if (!empty($_GET)){
extract($_GET);
}else if (!empty($HTTP_GET_VARS)){
extract($HTTP_GET_VARS);
}
if (!empty($_POST)){
extract($_POST);
}else if (!empty($HTTP_POST_VARS)){
extract($HTTP_POST_VARS);
}
include("config.inc.php");
include($functions_file);
echo($ueberschrift);
$activeladders = array($active_solo, $active_rt, $active_ffa, $active_at2v2, $active_at3v3, $active_at4v4);
$ladders = array("solo", "rt", "ffa", "at2v2", "at3v3", "at4v4");
$ladderbez = array($bez_solo, $bez_rt, $bez_ffa, $bez_at2v2, $bez_at3v3, $bez_at4v4);
for($i=0;$i<6;$i++){
if(!$activeladders[$i]){
unset($activeladders[$i]);
unset($ladders[$i]);
unset($ladderbez[$i]);
}
}
$activeladders = array_values($activeladders);
$ladders = array_values($ladders);
$ladderbez = array_values($ladderbez);
if(!$ladder) $ladder = $ladders[$startladder];
ladder($page,$pps,$ladder);
function gettemplate($nb){
$sql = "Select template from ladder_design where id='$nb'";
return str_replace("\"","\\\"",get_mysql_value($sql));
}
function ladder($page,$pps,$ladder){
GLOBAL $startpps, $dsgn_fontsize, $dsgn_fontcolor, $dsgn_showunranked, $dsgn_titlebgcolor, $dsgn_titlebold, $dsgn_bordercolor,
$dsgn_border, $dsgn_bgcolor, $dsgn_rankcolor, $imagefolder, $dsgn_lvlbgcolor, $ladderpath, $dsgn_lvlbordercolor,
$dsgn_bgcolor1, $dsgn_bgcolor2, $dsgn_bnrankstyle, $dsgn_titlecolor, $dsgn_titlesize, $dsgn_bnrankstyle2;
// Vorbereitungen
$ladderpath2 = split("\?", $ladderpath);
$ladderpath2 = $ladderpath2[0];
if($ladder == "solo" or $ladder == "rt" or $ladder == "ffa"){
$laddertype = "solo";
$player = "Player";
$ladder_nb = 0;
$sql_table = $ladder;
}
else{
$laddertype = $ladder;
$player = "Teams";
if($ladder == "at2v2"){
$ladder_nb = 1;
$sql_table = "2v2";
}
elseif($ladder == "at3v3"){
$ladder_nb = 2;
$sql_table = "3v3";
}
elseif($ladder == "at4v4"){
$ladder_nb = 3;
$sql_table = "4v4";
}
}
if(!$dsgn_bgcolor) $dualbg = 1;
if(!$pps){$pps=$startpps;}
$page2 = $page;
$page2--;
$beginfrom2 = $pps * $page2;
$sql = "Select * FROM ladder_".$sql_table." order by reihenfolge desc";
$account = get_mysql_rows($sql);
$nb_accs = count($account);
if($pps>$nb_accs){$pps=$nb_accs;}
$listend = $beginfrom2 + $pps;
$beginfrom = $beginfrom2 + 1;
$page = $page2 + 1;
if(($pps * $page) > $nb_accs){
$nb_player = $nb_accs % $pps;
}
else{
$nb_player = $pps;
}
if($nb_accs%$pps == "0"){
$lastpage = $nb_accs/$pps;
}
else{
$lastpage = floor($nb_accs/$pps) + 1;
}
$chose_ladder = chose_ladder($ladder);
$chose_page = pages($nb_accs,$page,$pps,$ladder);
if($page == "1"){
$prevpage = $lastpage;
}
else{
$prevpage = $page - 1;
}
if($page == $lastpage){
$nextpage = "1";
}
else{
$nextpage = $page + 1;
}
// Templates + Ausgabe
for($i=$beginfrom2;$i<$listend;$i++){
if($account[$i][0]){
if($laddertype == "solo"){
$name = $account[$i][0];
$level = $account[$i][1];
$wins = $account[$i][2];
$losses = $account[$i][3];
$exp = $account[$i][5];
$percent = $account[$i][6];
$bnrank = $account[$i][7];
$pic = '<img src="'.$imagefolder.'/'.get_pic($name).'.gif" border="0">';
}
elseif($laddertype == "at2v2"){
$name1 = $account[$i][0];
$name2 = $account[$i][1];
$level = $account[$i][2];
$wins = $account[$i][3];
$losses = $account[$i][4];
$percent = $account[$i][6];
$bnrank = $account[$i][7];
$pic1 = '<img src="'.$imagefolder.'/'.get_pic($name1).'.gif" border="0">';
$pic2 = '<img src="'.$imagefolder.'/'.get_pic($name2).'.gif" border="0">';
}
elseif($laddertype == "at3v3"){
$name1 = $account[$i][0];
$name2 = $account[$i][1];
$name3 = $account[$i][2];
$level = $account[$i][3];
$wins = $account[$i][4];
$losses = $account[$i][5];
$percent = $account[$i][7];
$bnrank = $account[$i][8];
$pic1 = '<img src="'.$imagefolder.'/'.get_pic($name1).'.gif" border="0">';
$pic2 = '<img src="'.$imagefolder.'/'.get_pic($name2).'.gif" border="0">';
$pic3 = '<img src="'.$imagefolder.'/'.get_pic($name3).'.gif" border="0">';
}
elseif($laddertype == "at4v4"){
$name1 = $account[$i][0];
$name2 = $account[$i][1];
$name3 = $account[$i][2];
$name4 = $account[$i][3];
$level = $account[$i][4];
$wins = $account[$i][5];
$losses = $account[$i][6];
$percent = $account[$i][8];
$bnrank = $account[$i][9];
$pic1 = '<img src="'.$imagefolder.'/'.get_pic($name1).'.gif" border="0">';
$pic2 = '<img src="'.$imagefolder.'/'.get_pic($name2).'.gif" border="0">';
$pic3 = '<img src="'.$imagefolder.'/'.get_pic($name3).'.gif" border="0">';
$pic4 = '<img src="'.$imagefolder.'/'.get_pic($name4).'.gif" border="0">';
}
$percent2 = 100 - $percent;
$rank = $i + 1;
if($dsgn_bnrankstyle){
if($rank%10 == "1" and $rank%100 != "11"){
$rank = $rank."<sup>st</sup>";
}
elseif($rank%10 == "2" and $rank%100 != "12"){
$rank = $rank."<sup>nd</sup>";
}
elseif($rank%10 == "3" and $rank%100 != "13"){
$rank = $rank."<sup>rd</sup>";
}
else{
$rank = $rank."<sup>th</sup>";
}
}
if($bnrank){
if($dsgn_bnrankstyle2){
if($bnrank%10 == "1" and $bnrank%100 != "11"){
$bnrank = $bnrank."<sup>st</sup>";
}
elseif($bnrank%10 == "2" and $bnrank%100 != "12"){
$bnrank = $bnrank."<sup>nd</sup>";
}
elseif($bnrank%10 == "3" and $bnrank%100 != "13"){
$bnrank = $bnrank."<sup>rd</sup>";
}
else{
$bnrank = $bnrank."<sup>th</sup>";
}
}
if($dsgn_rankcolor) $bnrank = "<font color=\"".$dsgn_rankcolor."\">".$bnrank."</font>";
}
else{
if($dsgn_showunranked){
$bnrank = "Unranked";
}
else{
$bnrank = "";
}
}
$tmp=1;
if($dualbg){
if($i%2 == "0" or $i == "0"){
$dsgn_bgcolor = $dsgn_bgcolor1;
}
else{
$dsgn_bgcolor = $dsgn_bgcolor2;
}
}
eval("\$rows .= \"".gettemplate(3 + $ladder_nb * 3)."\";");
if($dualbg) unset($dsgn_bgcolor);
}
}
if(!$tmp){
$nb_player = "0";
$beginfrom = "0";
$nb_accs = "0";
eval("\$rows = \"".gettemplate(4 + $ladder_nb * 3)."\";");
}
eval("\$table = \"".gettemplate(2 + $ladder_nb * 3)."\";");
eval("echo(\"".gettemplate(1)."\");");
}
function chose_ladder($cur){
GLOBAL $dsgn_fontsize, $dsgn_fontcolor, $ladders, $ladderbez, $ladderpath, $dsgn_seperator;
$nb_ladders = count($ladders);
for($i=0;$i<$nb_ladders;$i++){
if($ladders[$i]){
if($cur == $ladders[$i]){
$output .= "<b>".$ladderbez[$i]."</b>";
}
else{
$output .= "<a href=\"".$ladderpath."ladder=".$ladders[$i]."\">".$ladderbez[$i]."</a>";
}
if($i != ($nb_ladders - 1)){
$output .= " ".$dsgn_seperator." ";
}
}
}
return $output;
}
// Ladder Script by zuLu.TrunkZ
function pages($nb_accs,$page,$pps,$ladder){
GLOBAL $dsgn_fontsize, $dsgn_fontcolor, $ladderpath, $dsgn_seperator2, $dsgn_site;
$output = $dsgn_site." ";
$maxpages = $nb_accs / $pps;
$maxpages = floor($maxpages);
if($nb_accs -($maxpages * $pps) != 0){
$maxpages = $maxpages + 1;
}
$maxpages2 = $maxpages + 1;
if($maxpages2 > 25){
$max = 25;
}
else{
$max = $maxpages2;
}
for($i=1;$i<$max;$i++){;
if($i==$page){
$output .= "<b>".$i."</b>";
}
else{
$output .= "<a href=\"".$ladderpath."ladder=".$ladder."&page=".$i."&pps=".$pps."\">".$i."</a>";
}
if($i != $maxpages){$output .= " ".$dsgn_seperator2 ." ";
}
}
return $output;
}
do_not_remove_please($dsgn_fontsize,$dsgn_fontcolor);
?>
Brian
07-24-2004, 04:51 PM
Have you taken a look at this thread (http://www.vbadvanced.com/forum/showthread.php?t=1337)? If that one doesn't help then it will most likely require a bit of work to get that script to work with vBa.
Yes i read it but i dont understand what he did. I dont know how to edit the code to my needs. Im not a php whiz =\ (yet)
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.