Jump to content

Frontpage_Main.tpl Problem - Content Moved [SOLVED]


Recommended Posts

Posted

http://www.freshjetvirtual.com/index.php

Click above, you'll see that the content is displaced, and is down below the sidebar. This happened when I moved the sidebar code from the layout.tpl to the frontpage_main.tpl.

<!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=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://www.freshjetvirtual.com/lib/js/jquery.form.js"></script>
<script type="text/javascript" src="http://www.freshjetvirtual.com/lib/js/phpvms.js"></script>
</head>
<body>
<div id="sidebar1" class="sidebar">
		<ul>
			<li>

				<h2>News Centre</h2>
				<ul>
				<?php PopUpNews::PopUpNewsList(8); ?>
				</ul>
				<br>
				<h2>Newest Pilots</h2>
				<br>
				<?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>
				<br>
				<h2>Quick Stats</h2>
				<p><strong>Total Pilots: <?php echo StatsData::PilotCount(); ?></strong></p>
      	 				<p><strong>Total Flights Flown: </strong><?php echo StatsData::TotalFlights(); ?></p>
       				<p><strong>Total Aircraft: </strong><?php echo StatsData::TotalAircraftInFleet(); ?></p>
       				<p><strong>Total Hours Flown: </strong><?php echo StatsData::TotalHours(); ?></p>
       				<p><strong>Passengers Carried: </strong><?php echo StatsData::TotalPaxCarried(); ?></p>
       				<p><strong>Miles Flown: </strong><?php echo StatsData::TotalMilesFlown(); ?></p>
       				<p><strong>Total Flights Today: </strong><?php echo StatsData::totalflightstoday(); ?></p>
				<br>
				<h2>Flight Status</h2>
				<br>
				 <b><a href="http://www.freshjetvirtual.com/index.php/acars">Live Flight Information >></a></b><br>
			</li>

			</li>
		</ul>
</div>

<h2>Welcome to freshJet!</h2>
<marquee onmouseover="this.stop();" onmouseout="this.start();"><b>[09/05/2011]</b> Summer 2011 Schedules Delay Confirmed <b>[<a href="http://www.freshjetvirtual.com/index.php/PopUpNews/popupnewsitem/?itemid=18">More...</a>]</b>    <b>[05/06/2011]</b> 757 ready for introduction after delay <b>[<a href="http://www.freshjetvirtual.com/index.php/pages/757">More...</a>]</b></marquee>
<br>
<br>
Welcome to freshJet, one of the newest virtual airlines in the UK. We operate a wide variety of destinations across Europe to sun, ski and leisure destinations from our hubs at Glasgow and Belfast. We operate a modern fleet of Airbus A319 and A320 aircraft, including a lease for a single Boeing 757-200 in the summer for flights to Malta. We aim to provide the best experience for eveyone out there, offering realism, professionalism and a friendly community. Click <a href="http://www.freshjetvirtual.com/index.php/pages/whatweoffer">here</a> to see what else we have to offer.<br><br><br>
<br>
<center><img src="http://i.imgur.com/y0qld.png" /> <img src="http://i.imgur.com/b5oeb.png" /> <img src="http://i.imgur.com/PsA5e.png" /></center>
<br>
<br>
<h2>Book a Flight</h2>

<style type="text/css">
#outerdiv
{
width:500px;
height:400px;
overflow:hidden;
position:relative;
}

#inneriframe
{
position:absolute;
top:-250px;
left:-370px;
width:1280px;
height:1200px;
}
</style>
</head>
<body>
<div id='outerdiv'>
<iframe src="http://www.freshjetvirtual.com/index.php/FrontSchedules" id='inneriframe' scrolling=no></iframe>
</div> 

<h2>Latest Flights</h2>
<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table border="0" bordercolor="#000000" width="700" cellpadding="3" cellspacing="1">
  <thead>
    <tr>
      <th style="background-color:#05A2EA">Flight #</th>
      <th style="background-color:#05A2EA">Departure</th>
      <th style="background-color:#05A2EA">Arrival</th>
      <th style="background-color:#05A2EA">Duration</th>
      <th style="background-color:#05A2EA">Pilot</th>
    </tr>
   </thead>
   <tbody>	

<?php

if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   echo '<tr>';
   echo '<td>'.$pirep->code.$pirep->flightnum.'</td>';
   echo '<td>'.$pirep->depicao.'</td>';
   echo '<td>'.$pirep->arricao.'</td>';
   echo '<td>'.$pirep->flighttime.'</td>';
   echo '<td>'.$pilotid.' '.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</td>';
   echo '</tr>';
 }
}
else
{
   echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
  </tbody>
</table>
<br>
<a href="http://www.freshjetvirtual.com/index.php/acars">Live Flight Information >></a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>

</body>
</html>

Posted (edited)

Why not try putting:

<?php
if(MainController::$activeModule == 'FRONTPAGE'){ ?>
<!-- ADD YOUR SIDEBAR CODE HERE-->
<?php } ?>

In your layout.tpl file? This will only show the sidebar in the homepage

Regards,

James

(Thanks to Tom for giving me the code a while back)

EDIT: Didn't see Marks post, what I just said is an alternative way of doing what you wanted to do..

Edited by James142
  • Like 1
Posted

OK, thanks but the content is still down the bottom, but correctly aligned as you'll see.

Maybe try remove the <head> Tags in the frontpage_main.tpl file (as shown below) cause when the layout.tpl file is merged with the frontpage_main.tpl, there are two <head> tage and two <body> tage..

<div id="sidebar1" class="sidebar">
                       <ul>
                               <li>

                                       <h2>News Centre</h2>
                                       <ul>
                                       <?php PopUpNews::PopUpNewsList(8); ?>
                                       </ul>
                                       <br>
                                       <h2>Newest Pilots</h2>
                                       <br>
                                       <?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>
                                       <br>
                                       <h2>Quick Stats</h2>
                                       <p><strong>Total Pilots: <?php echo StatsData::PilotCount(); ?></strong></p>
                                       <p><strong>Total Flights Flown: </strong><?php echo StatsData::TotalFlights(); ?></p>
                                       <p><strong>Total Aircraft: </strong><?php echo StatsData::TotalAircraftInFleet(); ?></p>
                                       <p><strong>Total Hours Flown: </strong><?php echo StatsData::TotalHours(); ?></p>
                                       <p><strong>Passengers Carried: </strong><?php echo StatsData::TotalPaxCarried(); ?></p>
                                       <p><strong>Miles Flown: </strong><?php echo StatsData::TotalMilesFlown(); ?></p>
                                       <p><strong>Total Flights Today: </strong><?php echo StatsData::totalflightstoday(); ?></p>
                                       <br>
                                       <h2>Flight Status</h2>
                                       <br>
                                        <b><a href="http://www.freshjetvirtual.com/index.php/acars">Live Flight Information >></a></b><br>
                               </li>

                               </li>
                       </ul>
</div>

<h2>Welcome to freshJet!</h2>
<marquee onmouseover="this.stop();" onmouseout="this.start();"><b>[09/05/2011]</b> Summer 2011 Schedules Delay Confirmed <b>[<a href="http://www.freshjetvirtual.com/index.php/PopUpNews/popupnewsitem/?itemid=18">More...</a>]</b>    <b>[05/06/2011]</b> 757 ready for introduction after delay <b>[<a href="http://www.freshjetvirtual.com/index.php/pages/757">More...</a>]</b></marquee>
<br>
<br>
Welcome to freshJet, one of the newest virtual airlines in the UK. We operate a wide variety of destinations across Europe to sun, ski and leisure destinations from our hubs at Glasgow and Belfast. We operate a modern fleet of Airbus A319 and A320 aircraft, including a lease for a single Boeing 757-200 in the summer for flights to Malta. We aim to provide the best experience for eveyone out there, offering realism, professionalism and a friendly community. Click <a href="http://www.freshjetvirtual.com/index.php/pages/whatweoffer">here</a> to see what else we have to offer.<br><br><br>
<br>
<center><img src="http://i.imgur.com/y0qld.png" /> <img src="http://i.imgur.com/b5oeb.png" /> <img src="http://i.imgur.com/PsA5e.png" /></center>
<br>
<br>
<h2>Book a Flight</h2>

<style type="text/css">
#outerdiv
{
width:500px;
height:400px;
overflow:hidden;
position:relative;
}

#inneriframe
{
position:absolute;
top:-250px;
left:-370px;
width:1280px;
height:1200px;
}
</style>

<div id='outerdiv'>
<iframe src="http://www.freshjetvirtual.com/index.php/FrontSchedules" id='inneriframe' scrolling=no></iframe>
</div> 

<h2>Latest Flights</h2>
<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table border="0" bordercolor="#000000" width="700" cellpadding="3" cellspacing="1">
  <thead>
    <tr>
      <th style="background-color:#05A2EA">Flight #</th>
      <th style="background-color:#05A2EA">Departure</th>
      <th style="background-color:#05A2EA">Arrival</th>
      <th style="background-color:#05A2EA">Duration</th>
      <th style="background-color:#05A2EA">Pilot</th>
    </tr>
   </thead>
   <tbody>     

<?php

if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   echo '<tr>';
   echo '<td>'.$pirep->code.$pirep->flightnum.'</td>';
   echo '<td>'.$pirep->depicao.'</td>';
   echo '<td>'.$pirep->arricao.'</td>';
   echo '<td>'.$pirep->flighttime.'</td>';
   echo '<td>'.$pilotid.' '.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</td>';
   echo '</tr>';
 }
}
else
{
   echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
  </tbody>
</table>
<br>
<a href="http://www.freshjetvirtual.com/index.php/acars">Live Flight Information >></a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>

Im not sure if this will work though as I cant test it...

Posted

Nope didn't work. Something to do with the widths.

Looking at your site more closely, your sidebar code is outside the <div id="content"> when it should be inside it..

Posted

I've changed the code various times since the OP. When I had it as <div id="main">, the only CSS attribute was float:right, but this only right-aligned it at it's current position down the bottom.

Posted

Here's the current code in my layout.tpl, I used James' method:

<div id="wrapper">
<!-- start page -->
<div id="page">


	<!-- start content -->
	<div id="content">
	<?php
if(MainController::$activeModule == 'FRONTPAGE'){ ?>
<div id="sidebar1" class="sidebar">
                       <ul>
                               <li>

                                       <h2>News Centre</h2>
                                       <ul>
                                       <?php PopUpNews::PopUpNewsList(8); ?>
                                       </ul>
                                       <br>
                                       <h2>Newest Pilots</h2>
                                       <br>
                                       <?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>
                                       <br>
                                       <h2>Quick Stats</h2>
                                       <p><strong>Total Pilots: <?php echo StatsData::PilotCount(); ?></strong></p>
                                       <p><strong>Total Flights Flown: </strong><?php echo StatsData::TotalFlights(); ?></p>
                                       <p><strong>Total Aircraft: </strong><?php echo StatsData::TotalAircraftInFleet(); ?></p>
                                       <p><strong>Total Hours Flown: </strong><?php echo StatsData::TotalHours(); ?></p>
                                       <p><strong>Passengers Carried: </strong><?php echo StatsData::TotalPaxCarried(); ?></p>
                                       <p><strong>Miles Flown: </strong><?php echo StatsData::TotalMilesFlown(); ?></p>
                                       <p><strong>Total Flights Today: </strong><?php echo StatsData::totalflightstoday(); ?></p>
                                       <br>
                                       <h2>Flight Status</h2>
                                       <br>
                                        <b><a href="http://www.freshjetvirtual.com/index.php/acars">Live Flight Information >></a></b><br>
                               </li>

                               </li>
                       </ul>
</div>

<?php } ?>
	<?php echo $page_content; ?>
	</div>
	<!-- end content -->
	<div style="clear: both;"> </div>
</div>
<!-- end page -->
</div> <---- Is this an extra div?

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.

Loading...
×
×
  • Create New...