seany123 Posted September 5, 2008 Share Posted September 5, 2008 Im createing a small game/website... and ive designed the private header / template.. but now all the content is right at the bottom of the page instead of being where it should be. here is the code of my Private Header: <title>mafiakiller</title> <STYLE> <!-- tr { background-color: #000000} .normal { background-color: #000000; cursor: default } .highlight { background-color: #333333; cursor: pointer } //--> </style> <style type="text/css"> <!-- body,td,th { font-family: Times New Roman, Times, serif; font-size: 14px; color: #999999; } body { background-color: #000000; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } a { font-family: Times New Roman, Times, serif; font-size: 14px; color: #990000; font-weight: bold; } a:link { text-decoration: none; font-weight: bold; } a:visited { text-decoration: none; color: #990000; font-weight: bold; } a:hover { text-decoration: none; color: #990000; font-weight: bold; } a:active { text-decoration: none; color: #990000; font-weight: bold; } .style1 { color: #CCCCCC; font-weight: bold; } .style6 {font-weight: bold; color: #FFFFFF; } --> </style></head> <body> <table width="800" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td align="center" valign="top"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" align="center" valign="top"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="300" height="172" background="/images/banner7.jpg" no-repeat><!-- BannerFans.com code starts --><a href="http://www.BannerFans.com"></a><!-- BannerFans.com code ends --></td> <td width="500" height="172"><table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="4" colspan="10"></td> </tr> <tr> <td width="15"></td> <td width="48" height="20" class="style1">User</td> <td width="15"></td> <td height="20" colspan="2"><span class="left-section"> <?=$player->username?> </span></td> <td width="10"></td> <td width="50" height="20" class="style1">EXP</td> <td width="10"></td> <td width="100" height="20" align="left" valign="middle"> </td> <td width="12"></td> </tr> <tr> <td height="4" colspan="10"></td> </tr> <tr> <td width="15"></td> <td width="48" height="20" class="style1">Level</td> <td width="15"></td> <td height="20" colspan="2"><span class="left-section"> <?=$player->level?> </span></td> <td width="10"></td> <td width="50" height="20" class="style1">HP</td> <td width="10"></td> <td width="100" height="20" align="left" valign="middle"><img src="bargen.php?hp" alt="hp"></td> <td width="12"></td> </tr> <tr> <td height="4" colspan="10"></td> </tr> <tr> <td width="15"></td> <td width="48" height="20" class="style1">Money</td> <td width="15"></td> <td height="20" colspan="2">£<span class="left-section"><?=$player->money?> </span>[<a href="bank.php?auto=1">deposit</a>]</td> <td width="10"></td> <td width="50" height="20" class="style1">Energy</td> <td width="10"></td> <td width="100" height="20" align="left" valign="middle"><img src="bargen.php?energy" alt="energy"></td> <td width="12"></td> </tr> <tr> <td height="4" colspan="10"></td> </tr> <tr> <td width="15"></td> <td width="48" height="20" class="style1">Balance</td> <td width="15"></td> <td height="20" colspan="2"><b>£<?=$player->bank?> </b></td> <td width="10"></td> <td width="50" height="20" class="style1">Awake</td> <td width="10"></td> <td width="100" height="20" align="left" valign="middle"><img src="bargen.php?awake" alt="awake"></td> <td width="12"></td> </tr> <tr> <td height="4" colspan="10"></td> </tr> <tr> <td width="15"></td> <td width="48" height="20" class="style1">Points</td> <td width="15"></td> <td width="17" height="20"><?=$player->points?></td> <td width="223">[<a href="points.php">use</a>] [<a href="upgrade.php">buy</a>]</td> <td width="10"></td> <td width="50" height="20" class="style1">Nerve</td> <td width="10"></td> <td width="100" height="20" align="left" valign="middle"><img src="bargen.php?nerve" alt="nerve"></td> <td width="12"></td> </tr> <tr> <td height="4" colspan="10"></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="5" colspan="3"></td> </tr> <tr> <td colspan="3" align="center" valign="top"><table width="800" border="1" cellspacing="0" cellpadding="0"> <tr> <td><table width="798" height="25" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="10" valign="middle"></td> <td width="167" valign="middle" class="style1"> </td> <td width="10" valign="middle"></td> <td width="177" valign="middle" class="style1"><a href="vote.php"></a></td> <td width="10" valign="middle"></td> <td width="100" valign="middle"></td> <td width="10" valign="middle"></td> <td width="284" align="right" valign="middle" class="style1"></td> <td width="10" valign="middle"></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="5" colspan="3"></td> </tr> <tr> <td colspan="3" align="center" valign="top"><table width="800" border="1" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table></td> </tr> <tr> <td height="5" colspan="3"></td> </tr> <tr> <td width="145" align="center" valign="top"><table width="111" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="140" align="center" valign="top"><table width="140" border="1" cellpadding="1" cellspacing="1" bordercolor="#000000"> <tr> <td width="140" align="center" valign="middle" bordercolor="#990000" background="images/Menu_Title_Background.jpg" bgcolor="#000000"><span class="style6">Menu</span></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="home.php" width="140">Home</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="inventory.php">Inventory</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="city.php">London</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="bank.php">Bank</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="gym.php">Gym</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="Crime.php">Crime</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="yourgang.php">Your Gang</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="mailbox.php">Mail Box [0]</a></td> </tr> <tr><td width=140 align=left valign=middle bordercolor=#666666 bgcolor=#000000 onMouseOver=this.className='highlight' onMouseOut=this.className='normal'><a href=gangmail.php>Gang Mail [0]</a></td></tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="events.php">Events [0]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="prison.php">Prison [<span class=style1>4</span>]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="hospital.php">Hospital [<span class=style1>90</span>]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="vets.php">Vets [<span class=style1>19</span>]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="pound.php">Dog Pound [0]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="spylogs.php">Spy Logs</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="yourcars.php">Your Cars</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="yourpets.php">Your Pets</a></td> </tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="yourhof.php">Your HOF</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="notepad.php">Note Pad</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="search.php">Search</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="chatroom.php">Chat Room</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="forum.php">Forum</a></td> </tr> <tr> <td width="140" align="center" valign="middle" bordercolor="#FF0000" background="images/Menu_Title_Background.jpg" bgcolor="#000000" class="style6">Help</td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="supportdesk.php">Support Desk</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="bbcode.php">BBCode Help</a></td> </tr> <tr> <td width="140" align="center" valign="middle" bordercolor="#FF0000" background="images/Menu_Title_Background.jpg" bgcolor="#000000" class="style6">Account</td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="editaccount.php">Edit Account</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="contactlist.php">Contact List</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="manageignores.php">Manage Ignores</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" background="/images/menu_spacer.gif" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="upgrade.php">Upgrade</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#666666" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="logout.php">Logout</a></td> </tr> </table></td> </tr> </table></td> <td width="1"></td> <td width="656" align="center" valign="top"> </td> </tr> </table></td> </tr> </table> I have tried changing table sizes etc (dont know if i did it right) but it hasnt helped. Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/ Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 post the code that includes this header Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634408 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 its not one code / page... its every page.. which must indicate its a template / header... error. But at random.. this is one of the pages: <?php /*************************************/ /* ezRPG script */ /* Written by Zeggy */ /* http://code.google.com/p/ezrpg */ /* http://www.ezrpgproject.com/ */ /*************************************/ include("lib.php"); define("PAGENAME", "Hospital"); $player = check_user($secret_key, $db); if ($player->hp == $player->maxhp) { include("templates/private_header.php"); echo "<b>Nurse:</b><br />\n"; echo "<i>You are at full health! You don't need to be healed.</i>\n"; include("templates/private_footer.php"); exit; } else { //Add possibility of PARTIAL healing in next version? $heal = $player->maxhp - $player->hp; $cost = $heal * 1; //Replace 0 with variable from settings table/file if ($_GET['act']) { if ($player->gold < $cost) { include("templates/private_header.php"); echo "<b>Nurse:</b><br />\n"; echo "<i><font color=\"red\">You don't have enough gold!</i>\n"; include("templates/private_footer.php"); exit; } else { $query = $db->execute("update `players` set `gold`=?, `hp`=? where `id`=?", array($player->gold - $cost, $player->maxhp, $player->id)); $player = check_user($secret_key, $db); //Get new stats include("templates/private_header.php"); echo "<b>Nurse:</b><br />\n"; echo "<i>You have completely healed yourself!</i>\n"; include("templates/private_footer.php"); exit; } } include("templates/private_header.php"); //Add option to change price of hospital (life to heal * set number chosen by GM in admin panel) ?> <b>Nurse:</b><br /> <i>To completely heal yourself, it will cost <b><?=$heal?></b> Gold.</i> <br /> <a href="hospital.php?act=heal">Heal!</a> <?php include("templates/private_footer.php"); exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634413 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 To see what i mean... go to Rs2-shopping.com and login with: User: test pass: test Ive Removed some links but.. just scroll down to see home or click hospital. Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634415 Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 First of all these lines are not required include("templates/private_header.php"); //Add option to change price of hospital (life to heal * set number chosen by GM in admin panel) Remove this. try again and let me know the output. or you can simply post the html source you are getting in the browser. that will help Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634416 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 First of all these lines are not required include("templates/private_header.php"); //Add option to change price of hospital (life to heal * set number chosen by GM in admin panel) Remove this. try again and let me know the output. or you can simply post the html source you are getting in the browser. that will help I know //Add option Blah blah blah is not required but im using it to keep on track on everything and it doesnt effect anything? include("templates/private_header.php"); includes the template i need... if i dont include it will just be a white page with the content on. Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634417 Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 I mean the include thing not the comment. The sort out the problem you need to divide the page into different section. what you have done now won't work. You need to divide the page into 4 sections. 1- head 2- menu 3- content 4- footer you could write code in the content page and display contents. a normal page should look like this include(head); include(menu); content part content part content part include(footer); Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634418 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 so your suggesting a complete rebuild of the page.... Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634421 Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 yes that is the standard. or if you want temporary fix then do one thing Find in the header where you want to display the content. Assign a php variable <tr> <td> <?php print $content ?> </td> </tr> do all your php processing at the top before including the header and assign the contents to the $content variable. Then it will work. Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634426 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 do all your php processing at the top before including the header and assign the contents to the $content variable. Then it will work. Can you give me a Example? using the head i gave and hospital? Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634434 Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 header and footer has to come anyhow. make the includes at the bottom. don't try to include them in each if. <?php include("lib.php"); define("PAGENAME", "Hospital"); $player = check_user($secret_key, $db); if ($player->hp == $player->maxhp) { $content = "<b>Nurse:</b><br />\n"; $content. = "<i>You are at full health! You don't need to be healed.</i>\n"; } ---------- ----------- include("templates/private_header.php"); include("templates/private_footer.php"); and find a place in the header where want to include this content and add the following code <?php print $content ?> Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634438 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 Yes i has worked, but now i have to edit every page... thankyou for your help. Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634442 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 no i found it too hard to get it all to work... maybe one more example and i could learn from it.. <?php /*************************************/ /* ezRPG script */ /* Written by Zeggy */ /* http://code.google.com/p/ezrpg */ /* http://www.ezrpgproject.com/ */ /*************************************/ /* Modified for X-Panel */ /*************************************/ include("lib.php"); define("PAGENAME", "Home"); $player = check_user($secret_key, $db); include("templates/private_header.php"); ?> <table width="62%" border="0"> <tr> <td width="52%" height="115"><p><b>Username:</b> <?=$player->username?> <br /> <b>Email:</b> <?=$player->email?> <br /> <b>Registered:</b> <?=date("F j, Y, g:i a", $player->registered)?> <br /> <?php $diff = time() - $player->registered; $age = intval(($diff / 3600) / 24); ?> <b>Character Age:</b> <?=$age?> days<br /> <b>Kills/Deaths:</b> <?=$player->kills?> / <?=$player->deaths?> <br /> <br /> <?php if ($player->points > 10 && $player->energy < $player->maxenergy) { echo "<i>You have <b>" . $player->points . "</b> points to spend!<br />"; echo "<a href=\"points.php\">Spend them here</a></i>"; } else { echo "<br /><i>Energy Full!</i>"; } ?> </p> </td> <td width="48%" rowspan="2"> <p><b>Level:</b> <?=$player->level?> <br /> <?php $percent = intval(($player->exp / $player->maxexp) * 100); ?> <b>EXP:</b> <?=$player->exp?> / <?=$player->maxexp?> ( <?=$percent?> %)<br /> <b>HP:</b> <?=$player->hp?> / <?=$player->maxhp?> <br /> <b>Energy:</b> <?=$player->energy?> / <?=$player->maxenergy?> <br /> <b>Money:</b> <?=$player->money?> <br /> <strong>Nerve: <?=$player->nerve?> <br /> Awake:</strong><strong> <?=$player->awake?> </strong><br /> <br /> <b>Strength:</b> <?=$player->strength?> <br /> <b>Vitality:</b> <?=$player->vitality?> <br /> <b>Agility:</b> <?=$player->agility?> <br /> </p> </td> </tr> <tr> <td height="69"> </td> </tr> </table> <br /> <br /> <!-- Here you can put news updates or whatever. A News System will be coming next version! --> <? xpanel('news'); ?> <br /><br /> <? xpanel('xpanel_link'); ?> <center><a href="http://code.google.com/p/ezrpg">ezRPG Project</a></center> <!-- Yes, you may remove that link if you wish --> Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634457 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 bump Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634471 Share on other sites More sharing options...
trq Posted September 5, 2008 Share Posted September 5, 2008 What exactly is your question? Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634487 Share on other sites More sharing options...
seany123 Posted September 5, 2008 Author Share Posted September 5, 2008 How can i make to contents part of the page come back up next to the Template / private header. at the moment its right at the very bottom below the template. if you go on Rs2-shopping.com and login with User: test pass: test and scroll down, you will see that the contents of home.php is right at the bottom. Quote Link to comment https://forums.phpfreaks.com/topic/122845-private-header-templates/#findComment-634492 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.