Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

include code

Featured Replies

I know that I use:

 

<?php include("xxx.php"); ?>

 

and I can get the php file to show up but it's at the wrong height.

 

The style for this, which is a side bar, happens to be on the main page. Should it be on the sidebar file?

  • Author

sidebar.php:

 

<HEAD>

<TITLE></TITLE>

</HEAD>
<BODY BGCOLOR="#FFFFFF">

<div id="sidebar">
sidebar content
</div>

</BODY>

 

career.php:

 

style

<!--
body, td, th {
font-family: tahoma;
font-size: 10px;
text-align:justify;
color: #999999;
}
body {
margin:0px;
background-repeat:repeat-y;
background: #000000;
}

#sidebar {
position:absolute;
width:204px;
height:px;
z-index:1;
left: 13px;
top: 365px;
background-color: #FFFFFF;
float:left
}
#content {
position:absolute;
width:634px;
height:px;
z-index:2;
left: 228px;
top: 365px;
background-color: #FFFFFF;
float:right;
}
#welcome {
position:absolute;
width:372px;
height:119px;
z-index:3;
left: 377px;
top: 125px;
background-color: #FFFFFF;
}
#header {
position:absolute;
width:881px;
height:347px;
z-index:4;
left: 11px;
background-color: #000000;
top: 12px;
}
#container {
position:relative;
width:881px;
height:1100px;
left: 11px;
top: 21px;
background-color: #FFFFFF;
overflow: auto
}

.headline {font-size:8px; text-transform:uppercase; font-weight:bolder; color:#C30720; padding:2px; margin-bottom:2px; margin-top:2px; border-bottom:1px solid #C1C1C1; padding-left:10px;}
.headline2 {font-size:7px; text-transform:uppercase; font-weight:bolder; color:#D8A58A; padding:2px; margin-bottom:2px; margin-top:2px; border-bottom:1px solid #C1C1C1; padding-left:10px;}


a:link {color: #333333; text-decoration: none; font-size: 8Px; font-weight: bold; text-transform:uppercase;	overflow: auto;
overflow: scroll;	
background-image: url(pattern_138.gif);
background-image: url(pattern_138.gif);
}
a:visited {color: #333333; text-decoration: none; font-size: 8Px; font-weight: bold; text-transform:uppercase;}
a:hover {color: #DEB19C; text-decoration: none; font-size: 8Px; font-weight: bold; text-transform:uppercase;}
a:active {color: #333333; text-decoration: none; font-size: 8Px; font-weight: bold; text-transform:uppercase;}
#title {
position:absolute;
width:372px;
height:88px;
z-index:3;
left: 377px;
top: 23px;
background-color: #FFFFFF;
}
#header2 {
position:absolute;
width:881px;
height:1004px;
z-index:3;
left: 11px;
top: 19px;
background-color: #FFFFFF;
}
#welcome2 {
position:absolute;
left:379px;
top:132px;
width:357px;
height:111px;
z-index:5;
background-color: #FFFFFF;
}
.style1 {font-size: larger}
.style2 {
font-size: x-large
}
-->

 

layout:

<div id="container">
<div id="sidebar">
<?php include("sidebar.php"); ?>
</div>
<div id="content">
 <div class="headline">
<div align="center">CAREER</div>
 </div>
 <div align="center"><br />
TV<br />
<br />
<table width="458" cellpadding="5">
  <p>  </p>
  <tr>
	<td width="215"><a href="blackjack.php">Blackjack: At The Gate</a></td>
	<td width="114">Stephanie Turner</td>
	<td width="83">2006</td>
  </tr>
  <tr>
	<td><b><a href="headland.php">HEADLAND</a></b></td>
	<td>Grace Palmer</td>
	<td>2005</td>
  </tr>
  <tr>
	<td><b><a href="teacherspet.htm" target="iframe">Fireflies</a></b></td>
	<td>Lill Yengill </td>
	<td>2004</td>
  </tr>
  <tr>
	<td><b><a href="thepact.htm" target="iframe">stingers</a></b></td>
	<td>Ava Ryan </td>
	<td>2003</td>
  </tr>
  <tr>
	<td>All STAR SQUARES</td>
	<td>Herself - panellist</td>
	<td>1999</td>
  </tr>
  <tr>
	<td><b><a href="stealingharvard.htm" target="iframe">all saints</a></b></td>
	<td>Bronwyn Craig/Markham<br /></td>
	<td>1998-2003</td>
  </tr>

  <tr>
	<td><a href="speakingofsex.htm" target="iframe">pacific drive</a></td>
	<td>Zoe Marshall </td>
	<td>1996</td>
  </tr>
  <tr>
	<td><a href="everything.htm" target="iframe">frontline</a></td>
	<td>Patient</td>
	<td>1995</td>
  </tr>
  <tr>
	<td><a href="blue.php">blue healers</a></td>
	<td>Elizabeth</td>
	<td>1994-1995</td>
  </tr>
  <tr>
	<td><a href="anywherebuthere.htm" target="iframe">snowy river: the mecgregor saga</a></td>
	<td>Brodie</td>
	<td>1993</td>
  </tr>
  <tr>
	<td><b><a href="winchell.htm">bony</a></b></td>
	<td>Jennie</td>
	<td>1992</td>
  </tr>
  <tr>
	<td><b><a href="couples.htm" target="iframe">neighbours</a></b></td>
	<td></td>
	<td>1985</td>
  </tr>
</table>
<p align="center"><b>FILM</b></p>
<table width="371" cellpadding="5">
  <tr>
	<td width="139"><b><a href="life.php">life</a> </b></td>
	<td width="130">Jane</td>
	<td width="62">1996</td>
  </tr>
</table>
<p> </p>
<p><a href="java script:history.back(1)">back</a>   |   <a href="java script:location.reload()">refresh</a></p>
<p> </p>
 </div>
</div>  
</div>
</div>

 

would i need to have an external style sheet containing info for the sidebar linked in sidebar.php and another container the rest of the style info link to the main page?

Your sidebar.php should not include the HEAD and BODY elements.

<HEAD>

<TITLE></TITLE>

</HEAD>
<BODY BGCOLOR="#FFFFFF">

</BODY>

^ These should not be here. HEAD, TITLE and BODY elements should only be used once in a document, and they should be at the beginning of the document.

 

Is the layout file included by another file?

  • Author

thanks I have now removed the stuff from sidebar.php

 

the style is included in the main page in the <head></head>

 

this is what it currently looks like - here

thanks I have now removed the stuff from sidebar.php

 

the style is included in the main page in the <head></head>

 

this is what it currently looks like - here

 

Hi Debra, is that how you want it to look now? We need to know if its looking how you intended. ;)

  • Author

the sidebar should be inline with the content oposite.

I have them both as T 365px but the sidebar doesn't sit right

the sidebar should be inline with the content oposite.

I have them both as T 365px but the sidebar doesn't sit right

 

hmmm, not sure why, try changing the widths.

 

Also, its best to put auto if you want a fluid height object, instead of

 

height:px;

  • Author

I've changed the width but still it stays at the bottom of the page

Your page throws many errors. There's lots of unclosed tags. You'll have a much easier time debugging your layout after you correct the HTML errors.

If the HTML isn't correct it's nearly impossible to get a predictable layout.

  • Author

can someone point out which tags aren't closed?

Debra - your method of creating these files seems to have thrown you a curveball...

 

The best way to create a basic include template system is to:

* create a template in one file first - fully working, with every element you might need styled.

* cut the template into "above the per-page content" (excluding title tags) and "below the per-page content", usually above and below your <div id="content"> or similiar...

* include these two files at the top and bottom of each file.

 

have you tried to cut it up at programming-stage?

  • Author

I haven't a clue what you mean per 'per-page content'

 

I originally had the sidebar div on the page I then cut everything between <div id=sidebar></div>, and added in to a new page calling it sidebar.php

 

I have noticed that I have <div id=sidebar> twice is this due to sidebar.php going into div id=sidebar></div> on the main page?

sorry should have clarified.

 

per page content is the stuff which changes on each page - usually all the text. Things like your <head> tag and header area (ie the navbar etc) and the footer areas (copyright © bla biatch etc.) are things you should include into the page.

  • Author

I'm confused.

 

So on career.php I use an include code for the stuff you've mentioned and not for the side bar?

 

I thought I was to do 1 layout for all the pages, adding the content as it's different on each and then using an include for the sidebar (maybe the header if I can get the sidebar to work) or is that what you are saying?

basically yes...

 

all the stuff which is consistent on each page (eg between the DOCTYPE and the start of the content) is stored in one place... If your menu stays the same on each page (as it should ;)) then it should be stored in an included file.

 

But my main point was that you seem to be confused because you haven't got a clear idea what your page looks like when it is constructed... Try to put it all together into one html file (just to see), and check it from that nice syntax highlighted user interface ;)

  • Author

that is another think I am trying to remove.

 

When the content div goes over the height of the container div a scroll bar appears. I want it so the container div expands with the content div

 

EDIT: so I tryed validating it and now but the sidebar & content divs are way down the page - here

  • Author

you mean in the content div or the sidebar?

 

I started a new php file and added the style info in <head></head> then added divs tags and labeled them to go with the style.

Everything is lined up in dreamweaver. I then added the content in div id content & header and added the include to the sidebar.

Still the same. page is here sidebar file is here.

I don't have any body or head tags in the sidebar file.

  • Jo 90 locked this topic
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.