Jump to content
MakeWebGames

Layout Help


War_Hero

Recommended Posts

Hi all.

I've downloaded a theme/template based in HTML and I'm desperately trying to get it to work with my game, but I'm having no luck. The content of each page is 'outside' the actual layout. You'll probably understand more if you see a picture:

layoutgc.jpg

 

The stuff above and below the actual template should be inside the template where it is Layout Info, etc.

Another issue I have is with the staff page, which is completely screwed:

stafflayoutgc.jpg

Below is my header script:

<?php
class headers {
function startheaders() {
$key = substr($key = basename($_SERVER['PHP_SELF']), 0, strpos($key, "."));
$page = isset($table[$key]) ? $table[$key] : " ";
global $ir, $set;
print <<<EOF
<html>
<head>
<title>Desert Storm V1.0 - Layout (c) senkouryu.net</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style type = 'text/css' />
<!--
body {background-color:#D4C9A8;}
table, td {font-family:Verdana, Tahoma; font-size:10px; color:#382704;}
a {color:#6E5D2D;}
a:hover {color:#99875B;}
.navhead {display:block; font-weight:bold; text-align:center; color:ccc; border:1px solid #111; background:url(Images/banner.gif);}
-->
</style>
</head>
<body bgcolor='#D4C9A8' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>


<center>
<table background='Images/overall_bg.gif' id='Table_01' width='638' border='0' cellpadding='0' cellspacing='0'>
EOF;
}


function userdata($ir,$lv,$fm,$cm,$dosessh=1)
{
global $db,$c,$userid, $set;
$IP = $_SERVER['REMOTE_ADDR'];
$db->query("UPDATE users SET laston=unix_timestamp(),lastip='$IP' WHERE userid=$userid");
if(!$ir['email'])
{
global $domain;
die ('<body>Your Account May Be Broken. Please Contact Your E-Mail Stating Your Username And User ID.');
exit;
}
if($dosessh && ($_SESSION['attacking'] || $ir['attacking']))
{
print "You Lost All Your EXP For Running From A Fight Like A Coward.";
$db->query("UPDATE users SET exp=0,attacking=0 WHERE userid=$userid");
$_SESSION['attacking']=0;
}
$enperc=(int) ($ir['energy']/$ir['maxenergy']*100);
$wiperc=(int) ($ir['will']/$ir['maxwill']*100);
$experc=(int) ( $ir['exp']/$ir['exp_needed']*100);
$brperc=(int) ($ir['brave']/$ir['maxbrave']*100);
$hpperc=(int) ($ir['hp']/$ir['maxhp']*100);
$enopp=100-$enperc;
$wiopp=100-$wiperc;
$exopp=100-$experc;
$bropp=100-$brperc;
$hpopp=100-$hpperc;
$d='';
$_GET['ID'] = abs(@intval($_GET['ID']));
$_GET['viewforum'] = abs(@intval($_GET['viewforum']));
$_GET['viewtopic'] = abs(@intval($_GET['viewtopic']));
$stmr='';
$u=$ir['username'];
if($ir['user_level'] > 1) { $stmr="[img=staffimage here]"; };
if($ir['donatordays']) { $u = "<font color=red>{$ir['username']}</font>';$d='[img=donator.gif]"; }

$gn=''; 
global $staffpage;
if($ir['fedjail'])
{
$q=$db->query("SELECT * FROM fedjail WHERE fed_userid=$userid");
$r=$db->fetch_row($q);
die("[b]<hr /><font color=red size=+1>You Have Been Dragged Off To {$set['game_name']} Federal Prision For {$r['fed_days']} Day(s).<hr />

Reason: {$r['fed_reason']}</font>[/b]</body></html>");
}
print <<<OUT
<tr>
	<td colspan='5'>
		[img=Images/index_01.gif]</td>
</tr>
<tr>
	<td colspan='5'>
		[img=Images/banner.gif]</td>
</tr>
<tr>
	<td colspan='5'>
		[img=Images/index_03.gif]</td>
</tr>
<tr>
	<td colspan='4'>
		[img=Images/index_04.gif]</td>
	<td rowspan='2'>
		[img=Images/index_05.gif]</td>
</tr>
<tr>
	<td>
		[img=Images/index_06.gif]</td>
	<td>
		[img=Images/index_07.gif]</td>
	<td>
		[img=Images/index_08.gif]</td>
	<td>
		[img=Images/index_09.gif]</td>
</tr>
<tr>
	<td valign='top'>
		[img=Images/index_10.gif]</td>
	<td valign='top' background='Images/nav.gif' style='background-repeat:no-repeat;' width='127' height='23'>
OUT;
}

function menuarea() {
include "mainmenu.php";
global $ir, $c;
print "<div class='navhead'>Nav Bar</div>
		</td>
	<td valign='top'>
		[img=Images/index_12.gif]</td>
	<td valign='top' background='Images/nav.gif' style='background-repeat:no-repeat;' width='127' height='23'>";
}

function smenuarea() {
include "smenu.php";
global $ir, $c;
print "<div class='navhead'>Staff Bar</div>
</td>
	<td valign='top' background='Images/content.gif' style='background-repeat:no-repeat;' width='443' height='23'>";
}

function maincontent() {
global $ir, $c, $db;

  print "<div class='navhead'>Layout Info</div>

       [b]Layout Name:[/b] Desert Storm V1

       [b]Type:[/b] Tables, Div

       [b]Iframes:[/b] NO

       [b]Download Requirements:[/b]

        - No requirments needed.

       [b]Features:[/b]
- A Desert theme

       [b]Description:[/b]

        This simple layout is practice for me, a practice with color combinations that I haven\'t use, like this, a yellow-brownish-sand-like, for a desert theme :)
	 <div class='navhead'>Copyright & Final Comments</div>
	 This layout is copyrighted by SenkouRyu, don\'t edit the copyright info anywhere!

	 Be sure to check [url='http://www.senkouryu.net']http:\//www.senkouryu.net[/url] for more layouts like this or even better ones!


	</td>
	<td valign='top'>
		[img=Images/index_14.gif]</td>
</tr>
<tr>
	<td colspan='3'>
		[img=Images/index_17.gif]</td>
	<td>
		[img=Images/index_18.gif]</td>
	<td>
		[img=Images/index_19.gif]</td>
</tr>
<tr>
	<td>
		[img=Images/index_20.gif]</td>
	<td>
		[img=Images/index_21.gif]</td>
	<td>
		[img=Images/index_22.gif]</td>
	<td>
		[img=Images/index_23.gif]</td>
	<td>
		[img=Images/index_24.gif]</td>
</tr>";
}

function endpage() {
global $db;
print <<<OUT1
</table>
</center>
</body>
</html>
OUT1;
}
}
?>

 

Any advice or help will be highly appreciated. I honestly have tried getting this to work, but to no avail. Layouts and templates really aren't my forte.

Thank you,

Emlyn

Link to comment
Share on other sites

without seeing how your calling the main content in an example page .. ie index.php it would be hard to say exactly but my advice would be think of the header as a wrapper file that simply wraps the template around your called page (index.php for example)

you would want to define any tables or columns outside of the maincontent function so it loads inside of it.

 


function maincontent() {
   global $ir, $c, $db;
echo"<div class='navhead'>Layout Info</div>

<td>
";

}

echo"   
            </td>
       <td valign='top'>
           [img=Images/index_14.gif]</td>
   </tr>
   <tr>
       <td colspan='3'>
           [img=Images/index_17.gif]</td>
       <td>
           [img=Images/index_18.gif]</td>
       <td>
           [img=Images/index_19.gif]</td>
   </tr>
   <tr>
       <td>
           [img=Images/index_20.gif]</td>
       <td>
           [img=Images/index_21.gif]</td>
       <td>
           [img=Images/index_22.gif]</td>
       <td>
           [img=Images/index_23.gif]</td>
       <td>
           [img=Images/index_24.gif]</td>
   </tr>

";

function endpage() {
global $db;
print <<<OUT1
</table>
</center>
</body>
</html>
OUT1;
}
}
?>


 

this is just an example to represent that when the main content function is called it starts with a <TD> and then after the function you echo </TD> to close the tag that would put the content called from that function inside the <TD> content </TD> tags.

 

hope this helps WRX

Link to comment
Share on other sites

Thanks for the advice. :) I'm sort of following what you mean.

Here is my index.php

<?php
$housequery=1;
include "globals.php";
print "<h3>General Info:</h2>";
$exp=(int)($ir['exp']/$ir['exp_needed']*100);
$m=$db->query("SELECT * FROM users WHERE userid='{$ir['married']}'"); $par=$db->fetch_row($m);
if($ir['married'] != 0) { $partner= "[url='viewuser.php?u={$par[']<font color=green>{$par['username']}</font>[/url] [[url='partner.php']Manage[/url]]"; } else { $partner= "<font color=red>N/A</font>"; }
print "<table><tr><td>[b]Name:[/b] {$ir['username']}</td><td>[b]Race:[/b] {$ir['race']}</td></tr><tr>
<td>[b]Level:[/b] {$ir['level']}</td>
<td>[b]Exp:[/b] {$exp}%</td></tr><tr>
<td>[b]Money:[/b] $fm</td>
<td>[b]HP:[/b] {$ir['hp']}/{$ir['maxhp']}</td></tr>
<tr><td>[b]Property:[/b] {$ir['hNAME']}</td></tr>
<tr><td><font color=gold>[b]Golden Coins:[/b] {$cm}</font></td><td><font color=purple>[b]Rubies:[/b] {$ir['ruby']}</font></td></tr>
<tr><td>[b]Crime XP:[/b] {$ir['crimexp']}</td><td /><a href = 'mywarnings.php' title = 'View your warnings' /><font color = red>[b]MY WARNINGS[/b]</font></a></td></tr><td>[b]Married:[/b] $partner</td></tr></table>";
print "<hr><h3>Stats Info:</h3>";
$ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ'];
$ir['strank']=get_rank($ir['strength'],'strength');
$ir['agirank']=get_rank($ir['agility'],'agility');
$ir['guarank']=get_rank($ir['guard'],'guard');
$ir['labrank']=get_rank($ir['labour'],'labour');
$ir['IQrank']=get_rank($ir['IQ'],'IQ');
$tsrank=get_rank($ts,'strength+agility+guard+labour+IQ');
$ir['strength']=number_format($ir['strength']);
$ir['agility']=number_format($ir['agility']);
$ir['guard']=number_format($ir['guard']);
$ir['labour']=number_format($ir['labour']);
$ir['IQ']=number_format($ir['IQ']);
$ts=number_format($ts);

print "<table><tr><td><font color=red>[b]Strength:[/b] {$ir['strength']}</font> [Ranked: {$ir['strank']}]</td><td><font color=blue>[b]Agility:[/b] {$ir['agility']}</font> [Ranked: {$ir['agirank']}]</td></tr>
<tr><td><font color=green>[b]Guard:[/b] {$ir['guard']}</font> [Ranked: {$ir['guarank']}]</td><td><font color=brown>[b]Labour:[/b] {$ir['labour']}</font> [Ranked: {$ir['labrank']}]</td></tr>
<tr><td><font color=white>[b]IQ: [/b] {$ir['IQ']}</font> [Ranked: {$ir['IQrank']}]</td><td>[b]Total stats:[/b] {$ts} [Ranked: $tsrank]</td></tr></table>";
if(isset($_POST['pn_update']))
{
$db->query("UPDATE users SET user_notepad='{$_POST['pn_update']}' WHERE userid=$userid");
$ir['user_notepad']=stripslashes($_POST['pn_update']);
print "<hr>[b]Personal Notepad Updated![/b]";
}
print "<hr>Your Personal Notepad:<form action='index.php' method='post'>
<textarea rows='10' cols='50' name='pn_update'>".htmlspecialchars($ir['user_notepad'])."</textarea>

<input type='submit' value='Update Notes' /></form>";
$h->endpage();
?>

 

And, if needed, my globals.php

<?php
/*---------------------------------
--   MCCodes 2.0
--   By Dabomstew
---------------------------------*/
session_start();
ob_start();
if(get_magic_quotes_gpc() == 0)
{
 foreach($_POST as $k => $v)
 {
   $_POST[$k]=addslashes($v);
 }
 foreach($_GET as $k => $v)
 {
   $_GET[$k]=addslashes($v);
 }
}

require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";

include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
$domain=$_SERVER['HTTP_HOST'];

global $jobquery, $housequery;
if($jobquery)
{
$is=$db->query("SELECT u.*,us.*,j.*,jr.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON jr.jrID=u.jobrank WHERE u.userid=$userid");
}
else if($housequery)
{
$is=$db->query("SELECT u.*,us.*,h.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.userid=$userid");
}
else
{
$is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid");
}
$ir=$db->fetch_row($is);
if($ir['force_logout'])
{
$db->query("UPDATE users SET force_logout=0 WHERE userid=$userid");
session_unset();
session_destroy();
header("Location: login.php");
exit;
}
global $macropage;
if($macropage && !$ir['verified'] && $set['validate_on']==1)
{
header("Location: macro1.php?refer=$macropage");
exit;
} 
check_level();
$h = new headers;
$h->startheaders();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
global $atkpage;
if($atkpage)
{
$h->userdata($ir,$lv,$fm,$cm,0);
}
else
{
$h->userdata($ir,$lv,$fm,$cm);
}
global $menuhide;
if(!$menuhide)
{
$h->menuarea();
}
$h->maincontent();

?>

 

I've probably got all of this arse-backwards. I'm calling the maincontent function in the globals, but I'm not sure if it's correct or if the index.php is correct because of the new header.

Hmmm. "/

Link to comment
Share on other sites

maybe something like this then starting from smenuarea in header.php working to EOF

 

function smenuarea() {
   include "smenu.php";
   global $ir, $c;
   print "<div class='navhead'>Staff Bar</div>
   </td>
       <td valign='top' background='Images/content.gif' style='background-repeat:no-repeat;' width='443' height='23'>";
}

function maincontent() {
   global $ir, $c, $db;

     print "<div class='navhead'>Layout Info</div>

        ";
}

function endpage() {
global $db;
echo"


       </td>
       <td valign='top'>
           [img=Images/index_14.gif]</td>
   </tr>
   <tr>
       <td colspan='3'>
           [img=Images/index_17.gif]</td>
       <td>
           [img=Images/index_18.gif]</td>
       <td>
           [img=Images/index_19.gif]</td>
   </tr>
   <tr>
       <td>
           [img=Images/index_20.gif]</td>
       <td>
           [img=Images/index_21.gif]</td>
       <td>
           [img=Images/index_22.gif]</td>
       <td>
           [img=Images/index_23.gif]</td>
       <td>
           [img=Images/index_24.gif]</td>
   </tr>
</table>
</center>
</body>
</html>";
}
}
?>



html output should load like

$h->maincontent();

<index.php loads here >

$h->endpage();

Link to comment
Share on other sites

You are a star! :D Thank you so much. That solved the content bit on each page. :)

How would I go about solving the layout issue with the staff page, as that is still 'squiff', as it were?

Thanks again!

 

Awesome glad you got it to work.....

use the same principals we followed to correct your first issue.. to address the staff page follow how the html output is parsed for your staff page.

stafflayoutgc.jpg

from the looks of the screenie posted a table or column is being closed before the content loads into it causing the <TD> to be loaded with in a <TR>.

if you need help post it up and we can go thru it..

Link to comment
Share on other sites

I'll have a look when I get home, as I'm in school at the moment and can't get onto my server. Grr.

 

I had a thought....I created the function maincontent(). It wasn't in my old header before I tried using this template. I added $h->maincontent(); to globals.php but not to sglobals.php. Do you think that could be a possible cause to the problem?

 

Thank you for your help. I very much appreciate it. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...