Jump to content

[SOLVED] Dynamic PHP pages


makaveli80

Recommended Posts

Hi guys, I've been trying to figure this problem out for a long time and I have yet been unable to figure out any solutions, so any help would be most appreciated.

 

There are 3 sections to the site, there is a template so the pages can be edited one one page, then the changes apply all over.  Here is a jpg of what I was trying to do.

imageofproblem1dr8.th.jpg

 

The three files are head.php (header), index.php (main content), and tail.php (footer)

 

This is head.php , I tried to remove the end body and html tags to see if it would come up, but no luck.

<?
require("db.php");
include(dirname(__FILE__).'/session.php');
session_start();
require("functions.php");
require("login.php");

$query = mysql_query("SELECT * FROM site_config WHERE id='1'");
while($row = mysql_fetch_array($query))
{
foreach($row as $key => $value)
{
	$config[$key] = $value;
}
}
$total_new = mysql_query("SELECT * FROM sitepage WHERE ispage='1' AND isused='0'");
$totalnew = mysql_num_rows($total_new);
$total_acc = mysql_query("SELECT * FROM sitepage WHERE isacc='1'");
$totalacc = mysql_num_rows($total_acc);
$total_used = mysql_query("SELECT * FROM sitepage WHERE ispage='1' AND isused='1'");
$totalused = mysql_num_rows($total_used);
$user_id = GetUserID($username);
$wa = IsUserAdmin($user_id);
if($logged_in) {
if($wa == 1) {
$auth_access = 1;
} else {
$auth_access = 0;
}
}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="keywords" />
<meta name="description" content="descp" />
<title></title>
<link href="css/basic.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

<style type="text/css">
#dropmenudiv{
display:block;
width:200px;
position:absolute;
top:0;
left:0;
border:1px solid black;
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
color: #000000;
margin-top:-22px;
margin-left:200px;
filter:alpha(opacity=75);
-moz-opacity:.75;
opacity:.75;
}
pre
{
width:500px;
font:normal 12px Verdana;
color: #000000;
}
#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;
font-weight: bold;
color: #FFFFFF;
}

#dropmenudiv a:hover{ /*hover background color*/
background-color: blue;
}

body {
background-color: #FFFFFF;
}
</style>
</head>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/til_1.jpg" style="background-repeat:repeat-x; background-position:top "> </td>
    <td width="766" align="left" valign="top"><table width="766"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0','width','766','height','234','src','Flash/design-studio','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','Flash/design-studio' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="766" height="234">
            <param name="movie" value="flash.swf" />
            <param name="quality" value="high" />
            <embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="766" height="234"></embed>
        </object></noscript></td>
      </tr>
      <tr>
        <td align="left" valign="top"><table width="766"  border="0" cellspacing="0" cellpadding="0">
          <tr align="left" valign="top">
            <td width="249" height="100%"><table width="249" height="100%"  border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="100%" align="left" valign="top"><table width="249" height="100%"  border="0" cellpadding="0" cellspacing="0">
                  <tr align="left" valign="top">
                    <td width="18"><table width="18" height="100%"  border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="204" align="left" valign="top"><img src="images/left.jpg" width="18" height="204" /></td>
                      </tr>
                      <tr>
                        <td height="100%" align="left" valign="top" style="border-right:1px solid #CBCBCB "> </td>
                      </tr>
                    </table></td>
                    <td height="100%" style="border-right:1px solid #CBCBCB "><p> </p>
                      <p> </p>
                      <p>Login</p>
                      <p> </p>
                      <p>Navigation links</p></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="34" align="left" valign="top"><img src="images/bottom_1.jpg" width="249" height="34" /></td>
              </tr>
            </table></td>
            <td width="517"> </td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="5" align="left" valign="top"> </td>
      </tr>
      <tr>
        
      </tr>
    </table></td>
    <td background="images/image_2.jpg" style="background-position:top; background-repeat:repeat-x "> </td>
  </tr>
  <tr>
    <td> </td>
    <td width="766" align="left" valign="top"> </td>
    <td> </td>
  </tr>
</table>
</body>
</html>

 

This is basically the top part, and the left part. I can't put left part into index.php since the content changes and the left navigation dissapears...so I need it in head. 

 

This is the index.php file, it loads the main content, and it should be in center of the page.

<?
require("head.php");

$user_id = GetUserID($username);
$wa = IsUserAdmin($user_id);
if($logged_in) {
if($wa == 1) {
$auth_access = 1;
} else {
$auth_access = 0;
}
}
if($auth_access == 1) {
echo "<meta http-equiv=\"Refresh\" content=\"0;url=sitepage2.php\">";
exit;
}

?>
<? if(!$logged_in){ ?>
</td>
<table width="450" border="0" cellspacing="0" cellpadding="0">
<? if( empty($config['main_banner']) ){ ?>
      <tr>
        <td><div class="mainheading"> <font color="#9f3738"> What's new here?</font></div></td>
      </tr>
<? }else{ ?>
      <tr>
        <td><img src="save/<? echo($config['main_banner']); ?>" /></td>
      </tr>
<? } ?>
      <tr>
        <td><div align="left">
            <div class="mainsub"> Welcome To Our Website!</div>
        </div></td>
      </tr>
      <tr>
        <td></td>
      </tr>
</table>
<br />
      <?
require("tail.php");
?>

 

And this is the tail.php (footer) it's not so important since I can figure this out if I can manage to somehow get index into the center BESIDE the navigation instead of under it.

 

Again, any help would be most appreciated.

 

PS. I don't know if variables are important, I just want the main content to show up in the center...

Link to comment
Share on other sites

What are you trying to do? If you are just trying to swap those two blocks of text, why don't you just do that. Both of those things are in the same file (index.php). What do you mean by "Dynamic"?

 

The content that is loaded from index.php does not load on the page where I want it to. And I simply can't figure out how to make it go to the top, it's always at the bottom. The problem occurs since it's split into 3 sections, header, index (middle) and the footer. All those are seperate php files. If it was one page, I would be easily able to get it to go where I want, but in 3 files, I haven't been able to.

Link to comment
Share on other sites

Take this chunk OUT of your head.php:

</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="5" align="left" valign="top"> </td>
      </tr>
      <tr>
        
      </tr>
    </table></td>
    <td background="images/image_2.jpg" style="background-position:top; background-repeat:repeat-x "> </td>
  </tr>
  <tr>
    <td> </td>
    <td width="766" align="left" valign="top"> </td>
    <td> </td>
  </tr>
</table>
</body>
</html>

 

and put it at the top of the tail.php or the bottom of index.php.

Link to comment
Share on other sites

Hey lemmin,

 

thanks for the reply :) That almost works, I tried that as well. The problem when I do this is, everything gets pulled to the right hand side...including the header and index and footer. If I could figure out how to make everything centered then my problem would be solved.

 

Right now the index is showing exactly where I want it, just the entire page seems to have shifted to the far right.

 

any ideas how to center it? I've tried align left on all 3 pages but it doesn't seem to work?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.