PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Probleme mit Php-Include
Beitrag
<blockquote data-quote="Christian" data-source="post: 1357331" data-attributes="member: 3735"><p><strong>AW: Probleme mit Php-Include</strong></p><p></p><p>Hallo,</p><p></p><p>Dein Problem ist eigentlich mehr ein syntaktisches:</p><p>[php]<?php$seite = (isset($_GET['seite']))? $_GET['seite'] :</p><p>'';switch ($seite) {default :</p><p>case "standardseite" :include("inhalt1.html");break;</p><p>case "seite2" :include("datei2.php");break; </p><p>case "seite3" :include("datei3.php");break;</p><p>}?></p><p>[/php]</p><p>Wird so nicht funktionieren, weil dem php-open Tag direkt der Versuch einer Variablendefinition folgt. Du musst mindestens ein Leerzeichen lassen:</p><p>[php]<?php</p><p>$seite = (isset($_GET['seite'])) ? $_GET['seite'] : '';</p><p>switch ($seite) {</p><p> default:</p><p> case "standardseite":</p><p> include ("inhalt1.html");</p><p> break;</p><p> case "seite2":</p><p> include ("datei2.php");</p><p> break;</p><p> case "seite3":</p><p> include ("datei3.php");</p><p> break;</p><p>}</p><p>?></p><p>[/php]</p><p>Ergo:</p><p>[html]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></p><p><html xmlns="http://www.w3.org/1999/xhtml"></p><p><head></p><p><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></p><p><title>Unbenanntes Dokument</title></p><p><link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon"></p><p><link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon"></p><p><script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script></p><p><link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" /></p><p><style type="text/css"></p><p> body {</p><p> color: #000000; background-color: #FFFFFF;</p><p> font-size: 100.01%;</p><p> font-family: Helvetica,Arial,sans-serif;</p><p> margin: 0; padding: 1em 0;</p><p> text-align: center; /* Zentrierung im Internet Explorer */</p><p> }</p><p></p><p> div#Seite {</p><p> text-align: left; /* Seiteninhalt wieder links ausrichten */</p><p> margin: 0 auto; /* standardkonforme horizontale Zentrierung */</p><p> width: 760px;</p><p> padding: 0;</p><p> background: #7B7776 url(hintergrund.gif) repeat-y;</p><p> border: 2px ridge #000000;</p><p> }</p><p> div#Navigation {</p><p> float:left</p><p> }</p><p> h2 {</p><p> font-size: 1.2em;</p><p> margin: 0.2em 0;</p><p> color: #FFFFFF;</p><p> }</p><p></p><p> h1 {</p><p> font-size: 1.5em;</p><p> margin: 0; padding: 0.3em;</p><p> text-align: center;</p><p> background: #FFFFFF url(../../../src/logo.gif) no-repeat 100% 45%;</p><p> border-bottom: 1px solid #000000;</p><p> }</p><p> div#Inhalt {</p><p> margin: 0 0 1em 220px;</p><p> padding: 0 1em;</p><p> }</p><p> * html div#Inhalt {</p><p> height: 1em; /* Workaround gegen den 3-Pixel-Bug des Internet Explorer bis Version 6 */</p><p> margin-bottom: 0;</p><p> }</p><p> div#Inhalt p {</p><p> font-size: 1em;</p><p> margin: 1em 0;</p><p> }</p><p></p><p> div#Fusszeile {</p><p> clear: both;</p><p> font-size: 0.83em;</p><p> margin: 0; padding: 0.1em;</p><p> text-align: center;</p><p> background-color: #FFFFFF;</p><p> border-top: 1px solid #000000;</p><p> }</p><p></style></p><p></p><p></p><p></head></p><p></p><p><body style="background-image:url(bg.jpg); background-repeat:no-repeat; background-attachment:fixed; background-position:bottom right"></p><p><div id="Seite"></p><p><h1><img src="logo.jpg" width="750" height="300" border="0" alt=""></h1></p><p><div id="Navigation"></p><p><h3>Menü</h3></p><p> <ul id="MenuBar1" class="MenuBarVertical"></p><p> <li><a class="MenuBarItemSubmenu" href="index.php?seite=standardseite">Startseite</a></p><p> <ul></p><p> <li><a href="#">Element 1.1</a></li></p><p> <li><a href="#">Element 1.2</a></li></p><p> <li><a href="#">Element 1.3</a></li></p><p> </ul></p><p> </li></p><p> <li><a href="#">Element 2</a></li></p><p> <li><a class="MenuBarItemSubmenu" href="#">Element 3</a></p><p> <ul></p><p> <li><a class="MenuBarItemSubmenu" href="#">Element 3.1</a></p><p> <ul></p><p> <li><a href="#">Element 3.1.1</a></li></p><p> <li><a href="#">Element 3.1.2</a></li></p><p> </ul></p><p> </li></p><p> <li><a href="#">Element 3.2</a></li></p><p> <li><a href="#">Element 3.3</a></li></p><p> </ul></p><p> </li></p><p> <li><a href="#">Element 4</a></li></p><p> </ul></p><p></div></p><p><div id="Inhalt"></p><p></p><p><?php</p><p>$seite = (isset($_GET['seite'])) ? $_GET['seite'] : '';</p><p>switch ($seite) {</p><p> default:</p><p> case "standardseite":</p><p> include ("inhalt1.html");</p><p> break;</p><p> case "seite2":</p><p> include ("datei2.php");</p><p> break;</p><p> case "seite3":</p><p> include ("datei3.php");</p><p> break;</p><p>}</p><p>?></p><p></p><p></div></p><p><div id="Fußzeile">Hier kann der Link zu Impressum, Kontaktformular, AGB, ... erscheinen</div></p><p></div></p><p><script type="text/javascript"></p><p><!--</p><p>var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});</p><p>//--></p><p></script></p><p></body></p><p></html>[/html]</p><p>Das sollte es soweit auch gewesen sein, einen logischen Fehler kann ich hier nicht sehen.</p><p></p><p></p><p>Gruß Christian</p></blockquote><p></p>
[QUOTE="Christian, post: 1357331, member: 3735"] [b]AW: Probleme mit Php-Include[/b] Hallo, Dein Problem ist eigentlich mehr ein syntaktisches: [php]<?php$seite = (isset($_GET['seite']))? $_GET['seite'] : '';switch ($seite) {default : case "standardseite" :include("inhalt1.html");break; case "seite2" :include("datei2.php");break; case "seite3" :include("datei3.php");break; }?> [/php] Wird so nicht funktionieren, weil dem php-open Tag direkt der Versuch einer Variablendefinition folgt. Du musst mindestens ein Leerzeichen lassen: [php]<?php $seite = (isset($_GET['seite'])) ? $_GET['seite'] : ''; switch ($seite) { default: case "standardseite": include ("inhalt1.html"); break; case "seite2": include ("datei2.php"); break; case "seite3": include ("datei3.php"); break; } ?> [/php] Ergo: [html]<!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" /> <title>Unbenanntes Dokument</title> <link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon"> <link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon"> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" /> <style type="text/css"> body { color: #000000; background-color: #FFFFFF; font-size: 100.01%; font-family: Helvetica,Arial,sans-serif; margin: 0; padding: 1em 0; text-align: center; /* Zentrierung im Internet Explorer */ } div#Seite { text-align: left; /* Seiteninhalt wieder links ausrichten */ margin: 0 auto; /* standardkonforme horizontale Zentrierung */ width: 760px; padding: 0; background: #7B7776 url(hintergrund.gif) repeat-y; border: 2px ridge #000000; } div#Navigation { float:left } h2 { font-size: 1.2em; margin: 0.2em 0; color: #FFFFFF; } h1 { font-size: 1.5em; margin: 0; padding: 0.3em; text-align: center; background: #FFFFFF url(../../../src/logo.gif) no-repeat 100% 45%; border-bottom: 1px solid #000000; } div#Inhalt { margin: 0 0 1em 220px; padding: 0 1em; } * html div#Inhalt { height: 1em; /* Workaround gegen den 3-Pixel-Bug des Internet Explorer bis Version 6 */ margin-bottom: 0; } div#Inhalt p { font-size: 1em; margin: 1em 0; } div#Fusszeile { clear: both; font-size: 0.83em; margin: 0; padding: 0.1em; text-align: center; background-color: #FFFFFF; border-top: 1px solid #000000; } </style> </head> <body style="background-image:url(bg.jpg); background-repeat:no-repeat; background-attachment:fixed; background-position:bottom right"> <div id="Seite"> <h1><img src="logo.jpg" width="750" height="300" border="0" alt=""></h1> <div id="Navigation"> <h3>Menü</h3> <ul id="MenuBar1" class="MenuBarVertical"> <li><a class="MenuBarItemSubmenu" href="index.php?seite=standardseite">Startseite</a> <ul> <li><a href="#">Element 1.1</a></li> <li><a href="#">Element 1.2</a></li> <li><a href="#">Element 1.3</a></li> </ul> </li> <li><a href="#">Element 2</a></li> <li><a class="MenuBarItemSubmenu" href="#">Element 3</a> <ul> <li><a class="MenuBarItemSubmenu" href="#">Element 3.1</a> <ul> <li><a href="#">Element 3.1.1</a></li> <li><a href="#">Element 3.1.2</a></li> </ul> </li> <li><a href="#">Element 3.2</a></li> <li><a href="#">Element 3.3</a></li> </ul> </li> <li><a href="#">Element 4</a></li> </ul> </div> <div id="Inhalt"> <?php $seite = (isset($_GET['seite'])) ? $_GET['seite'] : ''; switch ($seite) { default: case "standardseite": include ("inhalt1.html"); break; case "seite2": include ("datei2.php"); break; case "seite3": include ("datei3.php"); break; } ?> </div> <div id="Fußzeile">Hier kann der Link zu Impressum, Kontaktformular, AGB, ... erscheinen</div> </div> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); //--> </script> </body> </html>[/html] Das sollte es soweit auch gewesen sein, einen logischen Fehler kann ich hier nicht sehen. Gruß Christian [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ★ = 12, ◇ = 4 und die Hälfte von ★ zu ◇ addiert wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Probleme mit Php-Include
Oben