Wie gesagt.. ein Server parst HTML-Dateien nicht -.-
Also wird PHP-Kram einfach in den Code geschrieben statt ausgewertet.. -.-
Sprache auswählen
-
-
Und das heißt so viel wie?
-
..ändere die Dateiendung deiner .html-Dateien in .php um.. und alles wird funktionieren..
-
hmm...der nimmt die index.php nicht an. Der zeigt nur die index.html.
Kann man denn die index als php verwenden?
Sie sieht im Moment so aus
PHP
Alles anzeigen<body> <?php session_start() ?> <div id="seitenbegrenzung"> <div id="kopfbereich"> <a href="index.php"> <img src="styles/RiensArtwork2.jpg" alt="" style="display: block; margin: auto;" /> </a> <!-- Sprache wählen --> <form id="changeLang" method="post" action="changeLang.php"> <select name="lang" onchange="document.getElementById('changeLang').submit();"> <option selected="selected">choose Language</option> <option value="en">English</option> <option value="de">Deutsch</option> </select> <input type="hidden" name="backlink" value="<?php echo $_SERVER['PHP_SELF'];?>" /> </form> </div> <div id="steuerung"> <ul id="navi"> <li><a href="index.php">Home</a></li> <li><a href="about.php">About</a></li> <li><a href="#">Gallery</a> <ul> <li><a href="nature.php">Nature</a></li> <li><a href="space.php">Space</a></li> </ul> </li> <li><a href="video.php">Video</a></li> <li><a href="gaestebuch.php">Guestbook</a></li> <li><a href="contact.php">Contact</a></li> </ul> </div> <div id="inhalt"> <h1>Home</h1> <br /> <?php function selectLanguage(array $content) { if(isset($content[$_SESSION['lang']])) { return $content[$_SESSION['lang']]; } else { return current($content); } } ?> <?php echo selectLanguage(array( "en" => " Welcome to Riens Artwork, <br /><br /> this site is devoted to displaying my numerous works, which is being continually updated. All paintings found on this site are done entirely with spraycan paint and<br /> some basic tools, and are all spraypainted on regular glossy photo paper. Each painting is one of a kind and no two paintings are totally alike, as it is impossible<br /> to replicate a piece of art. All paintings found on this site are all originals. The galleries provided are continuously being updated with new paintings, so make<br /> sure that you check it out regularly. It is also used as the primary resource regarding information about me and my background as an artist, as well as a means to contact me,<br /> whether it be for commission work, gallery opportunities, or even just for general information about the art itself. <br /><br /> Please have a look around and take a minute to contact me if you have questions. <br /><br /> Welcome and enjoy." "de" => " Hallo " ) ) ?> </div> </div> <div id="fusszeile"> © Copyright by RiensArtwork - <a href="impressum.php">Imprint/Disclaimer</a> </div> </body>
-
Ein Server zeigt normal immer zuerst die index.php an -.-
Und ja.. natürlich geht das mit index.php o.o
Fast jede Seite, die du besuchst wird eine index.php haben xD
Und selbst eine index.html ist bei einer großen Seite meistens eher eine index.php
Da kann man mit dem Server tricksensession_start() gehört übrigens nach gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz oben, noch vor den Doctype und so
-
-
Die Funktion schreisbt du da hin, wo du die Ausgabe haben willst.
Und ja, die Anführungszeichen sind so richtig^^ -
Alles klar.
ABER jetzt noch zwei Frage, übernimmt er den Session-Wert für alle Seiten oder nur für die jenige Seite, auf der man die Sprache gewählt hat?
Und muss ich das session_start() auf jede Seite schreiben?^^EDIT:
Die index.php sieht jetzt so aus.PHP
Alles anzeigen<?php session_start(); ?> <!DOCTYPE html> <head> <title>Riens Artwork - Index</title> <meta http-equiv="content-type" content="text/html; charset=windows-1252" /> <meta name="content-language" content="en" /> <meta name="language" content="English" /> <meta name="description" content="This is the official spray painting homepage of Rene Schell. This side contains Spray Paintings and further inforamtion about Rene Schell and the art" /> <meta name="author" content="Rene Schell" /> <meta name="publisher" content="Rene Schell" /> <meta name="copyright" content="Rene Schell" /> <meta name="keywords" content="Spraypainting, Spray Can, Spacepainting, Art, Rien, Riens Artwork, Rene schell" /> <meta name="robots" content="INDEX,FOLLOW" /> <meta name="generator" content="Webocton - Scriptly (www.scriptly.de)" /> <link href="style.css" type="text/css" rel="stylesheet" /> <link href="favicon.ico" type="image/x-icon" rel="shortcut icon" /> <!-- Including main style --> <link href="styles/mainstyle.css" type="text/css" rel="stylesheet" /> </head> <body> <div id="seitenbegrenzung"> <div id="kopfbereich"> <a href="index.php"> <img src="styles/RiensArtwork2.jpg" alt="" style="display: block; margin: auto;" /> </a> <!-- Sprache wählen --> <form id="changeLang" method="post" action="changeLang.php"> <select name="lang" onchange="document.getElementById('changeLang').submit();"> <option selected="selected">choose Language</option> <option value="en">English</option> <option value="de">Deutsch</option> </select> <input type="hidden" name="backlink" value="<?php echo $_SERVER['PHP_SELF'];?>" /> </form> </div> <div id="steuerung"> <ul id="navi"> <li><a href="index.php">Home</a></li> <li><a href="about.php">About</a></li> <li><a href="#">Gallery</a> <ul> <li><a href="nature.php">Nature</a></li> <li><a href="space.php">Space</a></li> </ul> </li> <li><a href="video.php">Video</a></li> <li><a href="gaestebuch.php">Guestbook</a></li> <li><a href="contact.php">Contact</a></li> </ul> </div> <div id="inhalt"> <h1>Home</h1> <br /> <?php function selectLanguage(array $content) { if(isset($content[$_SESSION['lang']])) { return $content[$_SESSION['lang']]; } else { return current($content); } } echo selectLanguage(array ( "en" => " Welcome to Riens Artwork, <br /><br /> this site is devoted to displaying my numerous works, which is being continually updated. All paintings found on this site are done entirely with spraycan paint and<br /> some basic tools, and are all spraypainted on regular glossy photo paper. Each painting is one of a kind and no two paintings are totally alike, as it is impossible<br /> to replicate a piece of art. All paintings found on this site are all originals. The galleries provided are continuously being updated with new paintings, so make<br /> sure that you check it out regularly. It is also used as the primary resource regarding information about me and my background as an artist, as well as a means to contact me,<br /> whether it be for commission work, gallery opportunities, or even just for general information about the art itself. <br /><br /> Please have a look around and take a minute to contact me if you have questions. <br /><br /> Welcome and enjoy." "de" => "Hallo")) ?> </div> </div> <div id="fusszeile"> © Copyright by RiensArtwork - <a href="impressum.php">Imprint/Disclaimer</a> </div> </body> </html>
Nachdem ich die echo selectLanguage eingefügt hatte, wird nichts mehr angezeigt. -
-
Nein, tut mir leid...das ; ändert nichts!
PHP
Alles anzeigen<?php function selectLanguage(array $content) { if(isset($content[$_SESSION['lang']])) { return $content[$_SESSION['lang']]; } else { return current($content); } } echo selectLanguage(array ( "en" => " Welcome to Riens Artwork, <br /><br /> this site is devoted to displaying my numerous works, which is being continually updated. All paintings found on this site are done entirely with spraycan paint and<br /> some basic tools, and are all spraypainted on regular glossy photo paper. Each painting is one of a kind and no two paintings are totally alike, as it is impossible<br /> to replicate a piece of art. All paintings found on this site are all originals. The galleries provided are continuously being updated with new paintings, so make<br /> sure that you check it out regularly. It is also used as the primary resource regarding information about me and my background as an artist, as well as a means to contact me,<br /> whether it be for commission work, gallery opportunities, or even just for general information about the art itself. <br /><br /> Please have a look around and take a minute to contact me if you have questions. <br /><br /> Welcome and enjoy." "de" => "Hallo")); ?>
Fehlermeldung bei w3
Error Line 1, Column 2: Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)<?php session_start() ?>
Error Line 64, Column 10: Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)
<?php
-
-
Oh mein Gott!
Ey..wie ich diese Fehler liebe...so banal
Danke man es geht!
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!