Probleme im switch mit PHP

Apache, Lighttpd, nginx, Cherokee
Post Reply
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Probleme im switch mit PHP

Post by hc丨andy »

Hallo,

also es geht um diese URL hier

http://www.Disco-Jens.de

da arbeite ich mit diesem Code

Code: Select all

<?php 
switch($site){
case "news": include("includes/news.php"); break;
case "referenzen": include("includes/referenzen.php"); break;
case "charts": include("includes/charts.php"); break;
case "galerie": include("includes/galerie.php"); break;
case "gaestebuch": include("includes/gaestebuch.php"); break;
case "links": include("includes/links.php"); break;
case "downloads": include("includes/downloads.php"); break;
case "kontakt": include("includes/kontakt.php"); break;
case "impressum": include("includes/impressum.php"); break;
default: include("includes/news.php"); break;
}
?> 
ich habe jede datei einzeln im ordner "includes" angelegt und mal testweise in jede einzelne.... geschrieben.....

das wird in der news.php angezeigt... nur halt zu jedem case auch die datei.... das ich praktisch sehe ob die navigation funktioniert..... was mache ich falsch?

bitte um schnelle hilfe..... auch wenn ich hier glaube falsch bin...
mmg-media
Posts: 99
Joined: 2003-06-23 12:40
Contact:
 

Re: Probleme im switch mit PHP

Post by mmg-media »

Probier das mal, das ist das häufigste Problem

Code: Select all

<?php 
switch($_GET['site']){ 
case "news": include("includes/news.php"); break; 
case "referenzen": include("includes/referenzen.php"); break; 
case "charts": include("includes/charts.php"); break; 
case "galerie": include("includes/galerie.php"); break; 
case "gaestebuch": include("includes/gaestebuch.php"); break; 
case "links": include("includes/links.php"); break; 
case "downloads": include("includes/downloads.php"); break; 
case "kontakt": include("includes/kontakt.php"); break; 
case "impressum": include("includes/impressum.php"); break; 
default: include("includes/news.php"); break; 
} 
?> 
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

hat geklappt!

großes DANKE ;) :P

vllt kann ich ja irgendwann auch mal was für dich tun ;)

Gruß Andy
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

ok hab doch nochmal ein weiteres aber kleineres problem....

und zwar werden da ketz keine umlaute angezeigt..... also für

ü ä ö Ã? kommen seltsame zeichen.... woran liegt das?

gruß Andy

http://www.disco-jens.de/index.php?site=impressum
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

Ersetzen Sie das Zeichen ä durch die Zeichenfolge &auml;
Ersetzen Sie das Zeichen Ã? durch die Zeichenfolge &Auml;
Ersetzen Sie das Zeichen ö durch die Zeichenfolge &ouml;
Ersetzen Sie das Zeichen Ã? durch die Zeichenfolge &Ouml;
Ersetzen Sie das Zeichen ü durch die Zeichenfolge &uuml;
Ersetzen Sie das Zeichen Ã? durch die Zeichenfolge &Uuml;
Ersetzen Sie das Zeichen Ã? durch die Zeichenfolge &szlig;

die funktionieren aber schonmal nicht.... :/
r00ty
Posts: 747
Joined: 2003-03-17 15:32
 

Re: Probleme im switch mit PHP

Post by r00ty »

na schau mal in den Sourcecode, den ein Seitenaufruf bei dir produziert:

Code: Select all

gem&auml;&szlig;
- da ist mir klar dass es nicht tut :)
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

aha und was amche ich also falsch?

hab das da jetz von dir eingefügt aber das geht auch nicht.....
r00ty
Posts: 747
Joined: 2003-03-17 15:32
 

Re: Probleme im switch mit PHP

Post by r00ty »

neeeeeeeeeeeeeein !!!
mach mich mal ein Testscript:

Code: Select all

<?
echo ("Test:<br>");
echo ("ä Ã?<br>");
echo ("&auml; &szlig;<br>");
echo (htmlspecialchars("ä Ã?"));
?>
und poste mir die URL
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

http://www.disco-jens.de/test.php

also hier funktioniert es......
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

aber im include sieht es wieder anderst aus....

http://www.disco-jens.de/index.php?site=kontakt

aber denke mal hab den fehler gefunden...... werd ich mal kurz unter impressum ausprobieren
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

ich hab gedacht das der fehler nur bei php kommt.... aber das muss irgendwie beim include passieren.....

habe jetz in eine impressum.htm erstellt und wollte mal testen ob das da auch ist....

http://www.disco-jens.de/includes/impressum.htm

aber hier wird alles ok angezeigt.... also hab ich mal in der impressum.php auf die impressum.htm verwiesen... aber nix....

das steht drin.....

Code: Select all

<?
include("includes/impressum.htm");
?>
die umlaute werden aber immernoch verhackt.... was kann ich noch machen?
r00ty
Posts: 747
Joined: 2003-03-17 15:32
 

Re: Probleme im switch mit PHP

Post by r00ty »

also bei der url die du gepostet hast ist bei mir alles I.O.
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

ja aber sobald die duch mein include geht wars das.......

pass auf....

http://www.disco-jens.de/index.php?site=test
mmg-media
Posts: 99
Joined: 2003-06-23 12:40
Contact:
 

Re: Probleme im switch mit PHP

Post by mmg-media »

Richtiger Zeichensatz und Sprache im HTML Code eingestellt?
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

eingestellt ist das hier

Code: Select all

<meta http-equiv="content-type" content="text/html; charset=utf-8">
r00ty
Posts: 747
Joined: 2003-03-17 15:32
 

Re: Probleme im switch mit PHP

Post by r00ty »

also ich sehe 4 Fragezeichen, ein ä und ein Ã?
und utf8 als encoding finde ich fragwürdig
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

ja das is unicode oder so...... welcher zeichensatz soll denn eingestellt sein?
r00ty
Posts: 747
Joined: 2003-03-17 15:32
 

Re: Probleme im switch mit PHP

Post by r00ty »

Code: Select all

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
hc丨andy
Posts: 19
Joined: 2003-11-05 21:56
Location: Wernigerode
Contact:
 

Re: Probleme im switch mit PHP

Post by hc丨andy »

danke es hat denn alles geklappt ;)
Post Reply