Fonction switch/include affichage par defaut
Résolu
gavroch74
Messages postés
65
Date d'inscription
Statut
Membre
Dernière intervention
-
gavroch74 Messages postés 65 Date d'inscription Statut Membre Dernière intervention -
gavroch74 Messages postés 65 Date d'inscription Statut Membre Dernière intervention -
Bonjour a tous et toutes, je me suis mis il y a peu au php
ainsi je cherche a refaire mon site principale en php
j'ai donc voulu m'intéresser au fonctions "include" et "switch" pour insérer
des pages en fonction du choix !
Tout marche a merveille mais quand on accède a mon site
<?php include("index.inc.php"); ?>
ne s'affiche pas, sauf si on viens cliquer sur le lien "index" !
Pouvez vous m'éclairer pour mettre l'include "index.inc.php" par défaut quand on arrive sur mon site ?
Voici mon code:
Merci d'avance pour votre aide !!!
yann
ainsi je cherche a refaire mon site principale en php
j'ai donc voulu m'intéresser au fonctions "include" et "switch" pour insérer
des pages en fonction du choix !
Tout marche a merveille mais quand on accède a mon site
<?php include("index.inc.php"); ?>
ne s'affiche pas, sauf si on viens cliquer sur le lien "index" !
Pouvez vous m'éclairer pour mettre l'include "index.inc.php" par défaut quand on arrive sur mon site ?
Voici mon code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > <head> <title>Mon super site</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="..." /> <meta http-equiv="Content-Language" content="fr" /> <meta name="keywords" lang="fr" content="...t" xml:lang="fr" /> <link rel="shortcut icon" type="image/x-icon" href="/icone/favicon.ico" /> <link rel="stylesheet" type="text/css" href="feuille-de-style.css" /> </head> <body> <?php include("entete.inc.php"); ?> <?php include("colonne-gauche.inc.php"); ?> <?php include("colonne-droite.inc.php"); ?> <?Php switch($page) { case'index': <a href="index.php?page=index"> include("index.inc.php"); break; case'manuels': <a href="index.php?page=manuels"> include("manuels.inc.php"); break; case'copi': <a href="index.php?page=forum"> include("copi.inc.php"); break; case'contact': <a href="index.php?page=forum"> include("contact.inc.php"); break; case'traitement': <a href="index.php?page=forum"> include("traitement.inc.php"); break; } ?> </body> </html>
Merci d'avance pour votre aide !!!
yann
A voir également:
- Fonction switch/include affichage par defaut
- Fonction si et - Guide
- Ouvrir avec par défaut - Guide
- Affichage double ecran - Guide
- Google page d'accueil par défaut - Guide
- Android switch - Accueil - Android
2 réponses
Bonjour, il faut que tu ajoute l'action par défaut dans ton switch ;)
<?Php switch($page) { case'index': <a href="index.php?page=index"> include("index.inc.php"); break; case'manuels': <a href="index.php?page=manuels"> include("manuels.inc.php"); break; case'copi': <a href="index.php?page=forum"> include("copi.inc.php"); break; case'contact': <a href="index.php?page=forum"> include("contact.inc.php"); break; case'traitement': <a href="index.php?page=forum"> include("traitement.inc.php"); break; default : <a href="index.php?page=index"> break; } ?>