Problem mit Variablen-Übergabe in der URL#reloaded

LLDenny

Grünschnabel
Re: Problem mit Variablen-Übergabe in der URL

Hallo, ich habe folgenes Problem

Folgendes:

Ich habe 3 Seiten eine leere Layoutseite, eine Newsseite und eine config.php

in der config.php steht folgendes:

<?php
//config.php

$dateien = array(); //Erstellt einen neuen Array $dateien
$dateien['samy_deluxe'] = "news.php"; //für jede Section ein neue Variable
$dateien['snoop_dogg'] = "news.php"; //usw.
$dateien['50cent'] = "news.php";
$dateien['xibit'] = "news.php";
$dateien['warreng'] = "news.php";
$dateien['usher'] = "news.php";
$dateien['loon'] = "news.php";
$dateien['fettes_brot'] = "news.php";
$dateien['eminem'] = "news.php";
$dateien['afrob'] = "news.php";
?>

in der News habe ich links wie z.B. <a href="news.php?section=samy_deluxe">mehr</a>

Jetzt möchte ich in der Layoutseite von der Newsseite $_GET übermittelte section´s empfangen und schauen welche z.B. gerade in der Adressleiste steht z.B "news.php?section=samy_deluxe" um für die Layoutseite den richtigen Inhalt extern zu laden.

Mit diesem Code läuft es zwar, aber es bezieht sich halt nur auf die SECTION selbst.

<?php
if (isset($_GET["section"])) {
include("samy_deluxe.shtml");
}
?>

Danke für Eure Hilfe.
 
Re: Problem mit Variablen-Übergabe in der URL

meinst du jetzt das?
PHP:
<?php
  if (isset($_GET['section'])) {
    switch($_GET['section']){
      case 'samy_deluxe' : include 'samy_deluxe.shtml'; break;
      case 'snoop_dogg'   : include 'snoop_dogg.shtml'; break;
    }
  } 
?>
 
Zurück