Positionierung mit PHP

Status
Nicht offen für weitere Antworten.

florianboensch

Grünschnabel
Hallo,

ich bin gerade dabei meine erste Homepage mit php zu erstellen. Ich habe eine navi.php und möchte diese in eine Seite mit Tabellen einfügen. Eine Tabelle ist links und eine oben. Nun habe ich folgendes Problem. Wenn ich die navi.php include, wird diese immer ganz oben links angezeigt (siehe Bild).

Wie kann ich die position der includeten navi.php bestimmen?
Ich möchte gerne das dass Menü weiter unten angezeigt wird.

Ich hoffe mir kann jemand helfen.

Danke im vorraus

hier noch des code:

PHP:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Neue Seite 1</title>
<style type="text/css">
.style1 {
	text-align: center;
}
.style2 {
	background-color: #FFFFFF;
}
.style4 {
	text-align: left;
}
</style>
</head>

<body bgcolor="#D9D8B1">

<form id="form1" runat="server">

<table border="0" cellpadding="0" cellspacing="0" width="1055" height="658" align="center">
	<!-- MSTableType="layout" -->
	<tr>
		<td valign="top" colspan="2" height="90" class="style1">
		<!-- MSCellType="ContentHead" -->
		<table class="style2">
	<tr>
		<td class="style1">
		<img alt="" src="http://www.tutorials.de/forum/images/autec_logo.gif" width="150" height="78"></td>
		<td class="style4"><img src="http://www.tutorials.de/forum/images/banner.png" width="600" height="60"><br>
		<span class="style1">Projektierung - Konstruktion - CAD</span></td>
	</tr>
	<tr>
		<td class="style1">&nbsp;</td>
		<td class="style1">&nbsp;</td>
	</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td msopnltype="NavBody" rowspan="2" width="181">
		<!-- MSCellType="NavBody" -->
		<br>
		<br>
		<br>
		<br>
		<br>
		&nbsp;

<?php
include "navi.php"
?>		
		</td>
		<td valign="top" height="508">
		<!-- MSCellType="ContentBody" -->
		&nbsp;<p>&nbsp;</td>
	</tr>
	<tr>
		<td height="60" width="874">&nbsp;</td>
	</tr>
</table>

</form>

</body>

</html>
 

Anhänge

  • bild1.jpg
    bild1.jpg
    56,6 KB · Aufrufe: 42
Zuletzt bearbeitet:
du hast doch zwei super möglichkeiten dafürm, die eine wäre es ein margin-top zu verwenden mit css, oder die andere, etwas ältere und doch immernoch funktionierende Variante wäre das positionieren mit HTML, dazu bastelst du dir einfach ne Tabelle, welche du unsichtbar schaltest und schon ist es da, wo du es haben möchtest...
 
Erstmal danke für die schnelle Hilfe!
Also das mit der Tabelle habe ich versucht aber leider klappt es nicht.

Hier nochmal der code

HTML:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Neue Seite 1</title>
<style type="text/css">
.style1 {
	text-align: center;
}
.style2 {
	background-color: #FFFFFF;
}
.style4 {
	text-align: left;
}
</style>
</head>

<body bgcolor="#D9D8B1">

<form id="form1" runat="server">

<table border="0" cellpadding="0" cellspacing="0" width="1055" height="658" align="center">
	<!-- MSTableType="layout" -->
	<tr>
		<td valign="top" colspan="2" height="90" class="style1">
		<!-- MSCellType="ContentHead" -->
		<table class="style2">
	<tr>
		<td class="style1">
		<img alt="" src="http://www.tutorials.de/forum/images/autec_logo.gif" width="150" height="78"></td>
		<td class="style4"><img src="http://www.tutorials.de/forum/images/banner.png" width="600" height="60"><br>
		<span class="style1">Projektierung - Konstruktion - CAD</span></td>
	</tr>
	<tr>
		<td class="style1">&nbsp;</td>
		<td class="style1">&nbsp;</td>
	</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td msopnltype="NavBody" rowspan="2" width="181" valign="top">
		<!-- MSCellType="NavBody" -->
		<br>
		<br>
		<br>
		<br>
		<table style="width: 100%">
			<tr>
				<td>
				<?php
				include "navi.php"
				?>		

				</td>
			</tr>
		</table>
		</td>
		<td valign="top" height="508">
		<!-- MSCellType="ContentBody" -->
		&nbsp;<p>&nbsp;</td>
	</tr>
	<tr>
		<td height="60" width="874">&nbsp;</td>
	</tr>
</table>

</form>

</body>

</html>
 
Zuletzt bearbeitet:
Hallo,

ich habe das ganze jetzt auch nochmal mit CSS probiert, doch leider klappt das auch nicht.
Ich kann mir aber nicht erklären warum!!

Anbei der Code mit CSS

Danke im vorraus

HTML:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Neue Seite 1</title>
<style type="text/css">
div.navi { margin-top:150px;}
	
}
.style1 {
	text-align: center;
}
.style2 {
	background-color: #FFFFFF;
}
.style4 {
	text-align: left;
}
</style>
</head>

<body bgcolor="#D9D8B1">

<form id="form1" runat="server">

<table border="0" cellpadding="0" cellspacing="0" width="1055" height="658" align="center">
	<!-- MSTableType="layout" -->
	<tr>
		<td valign="top" colspan="2" height="90" class="style1">
		<!-- MSCellType="ContentHead" -->
		<table class="style2">
	<tr>
		<td class="style1">
		<img alt="" src="images/autec_logo.gif" width="150" height="78"></td>
		<td class="style4"><img src="images/banner.png" width="600" height="60"><br>
		<span class="style1">Projektierung - Konstruktion - CAD</span></td>
	</tr>
	<tr>
		<td class="style1">&nbsp;</td>
		<td class="style1">&nbsp;</td>
	</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td msopnltype="NavBody" rowspan="2" width="181" valign="top">
		<!-- MSCellType="NavBody" -->
		<br>
		<div class="navi"></div>
		<?php
		include "navi.php"
		?>	
				
		</td>
		<td valign="top" height="508">
		<!-- MSCellType="ContentBody" -->
		&nbsp;<p>&nbsp;</td>
	</tr>
	<tr>
		<td height="60" width="874">&nbsp;</td>
	</tr>
</table>

</form>

</body>

</html>
 
Hallo florianboensch,

versuchs mal so:
PHP:
 <div class="navi">
    <?php
    include "navi.php"
    ?>
</div>

Viel Spass
Gruß Matze
 
div.navi { margin-top:150px;}

}

ich würde erstmal ein geschweifte Klammer entfernen ;)
und dann probiere es mal mit einem float div aus, das du dann mit margin-top:150px vom oberen Rand wegdrückst, aber es müsste eigentlich auch ohne float klappen Oo
 
Hallo,

versuch mal die CSS Deklaration so zu gestalten:
PHP:
<style type="text/css">
<!--
.navi { margin-top:10px;}

.style1 {
  text-align: center;
}
.style2 {
  background-color: #FFFFFF;
}
.style4 {
  text-align: left;
}
-->
</style>


Viel Spass
Gruß Matze
 
Mir ist ein Fehler in deinem Code aufgefallen:
HTML:
<tr>
        <td msopnltype="NavBody" rowspan="2" width="181">
        <!-- MSCellType="NavBody" -->
        <br>
        <br>
        <br>
        <br>
        <br>
        &nbsp;

<?php
include "navi.php"
?>        
        </td>
        <td valign="top" height="508">
        <!-- MSCellType="ContentBody" -->
        &nbsp;<p>&nbsp;</td>
    </tr>

Du benutzt hier zwei Spalten (<td>'s). Für mich sieht das sehr seltsam aus, da du in der zweiten Spalte nicht reinschreibst, ausser Leerzeichen. Zusätzlich machst du noch in der ersten Spalte ein rowspan="2", was eigentlich in die Spalte deines Contents müsste. Versuch diesen Codeabschnitt mal anstelle von deinem:
HTML:
<tr>
        <td>
            <?php
                 include "navi.php"
            ?>        
        </td>
    </tr>


drüße djjada
 
Status
Nicht offen für weitere Antworten.
Zurück