Pag d'accueil en PHP avec pseudo-frames

Résolu
Mysterious_fea Messages postés 401 Date d'inscription   Statut Membre Dernière intervention   -  
Mysterious_fea Messages postés 401 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
Question bête, mais c'est important : j'ai une page index.php qui contient en fait tout mon site (index.php?page="nom_de_la_page)
Comment faire pour que "/" pointe vers la vrai page d'accueil (c'est à dire index.php?page=accueil) ?
Faut-il traffiquer le .htaccess (sachant que je suis chez Free, c'est pas génial...) ou modifier index.php (et lui dire que quand il n'y a pas de variable "page", elle appelle la pseudo-frame de la page d'accueil (c'est à dire accueil.php) ?
Merci
A voir également:

4 réponses

naruto-94 Messages postés 865 Date d'inscription   Statut Membre Dernière intervention   188
 
<?php

switch ($_GET['page']):
case accueil:
echo "<a href=\"/\">Spider's Web</a> / ";
    break;
case prestation:
 echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=prestations>Prestations</a> / ";
    break;
case realisations:
             echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=realisations>R&eacute;alisations</a> / ";
    break;

[ETC...]

default:
    echo "<a href=\"/\">Spider's Web</a> / ";
endswitch;
?>


Voila je n'ai pas tout fait a toi de terminé .... suffit de copier/coller et de changer les valeurs .
2
naruto-94 Messages postés 865 Date d'inscription   Statut Membre Dernière intervention   188
 
Salut,

Ben j'en deduis que tu utilise un switch donc tu dois mettre une valeur par defaut . si tu utilise des if change sa tout de suite !

default:
    include('accueil.php');
endswitch;

0
Mysterious_fea Messages postés 401 Date d'inscription   Statut Membre Dernière intervention   35
 
j'utilise des if :
<?php
    if ($_GET['page'] == "accueil")
    {
        echo "<a href=\"/\">Spider's Web</a> / ";
    }
   
    if ($_GET['page'] == "prestations")
    {
        echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=prestations>Prestations</a> / ";    }
   
    if ($_GET['page'] == "realisations")
    {
        echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=realisations>R&eacute;alisations</a> / ";    }
    if ($_GET['page'] == "tarifs")
    {
        echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=tarifs>Tarifs</a> / ";    }

   
    if ($_GET['page'] == "contact")
    {
        echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=contact>Contact</a> / ";    }

   
    if ($_GET['page'] == "sitemap")
    {
        echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=sitemap>Plan du site</a> / ";    }

 
    if ($_GET['page'] == "apropos")
    {
        echo "<a href=\"/\">Spider's Web</a> / <a href=index.php?page=apropos>&Agrave; propos</a> / ";
    } 
    ?>

C'est vrai c'est bizarre j'y ai pas pensé mais c'était comme ça sur le Site du Zér0, bizarre...
Donc quel est le code pour le switch STP ?
Merci
0
Mysterious_fea Messages postés 401 Date d'inscription   Statut Membre Dernière intervention   35
 
Merci beaucoup, c'est parfait !
A+
0