Aller au contenu
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pb avec php et les includes ? [RESOLUT]

Featured Replies

Posté(e)

Bonjours, j'essèye de faire un site avec des includes, mais je n'y arrive pas, la premiere page s'affiche et puis dès que je clique sur un lien sa m'envoit la page d'erreur de IntE, pourtant le code fonctionne partièlement vu que la premiere page s'affiche.

Voici le code source :

Fichier index.php :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>testtitle>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

</head>

<body>

<p><a href="includes/index.php?page=home">Home</a></p> <p><a href="includes/index.php?page=news">News</a></p>

<p><a href="includes/index.php?page=articles">Articles</a></p>

<p> </p>

<?php

include('includes/center.php');

                ?>

</body>

</html>

Voici le fichier center.php :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Document sans titre</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>

<?php

if ($_GET['page']=='home' || empty($_GET['page']) ) {include('includes/home.php');}

elseif ($_GET['page']=='news') {include('includes/news.php');}

elseif ($_GET['page']=='articles') {include('includes/articles.php');}

else {include('includes/404.php');}

?>

</body>

</html>

Voici comment est organiser le répertoire :

dossier/:

          index.php

          includes/:

                    home.php

                    news.php

                    404.php

                    articles.php

                    center.php

Y'a t'il des fautes dans le code source ?

Je test sous apache 2, c'est possible que se soit lui qui foire ?

Sinon quel autre logiciel permet de tester un site en local qui supporte le php nativement ?

Merci d'avance.

Siron

Posté(e)

pour changer de dossier avec les includes, il faut un

 ./dossier/fichier.ext

exemple :

elseif ($_GET['page']=='news') {include('./includes/news.php');}

Posté(e)

Dans ton premier fichier, tu écris les balises HTML standard (HTML, HEAD, BODY, etc...), puis tu inclus le "center.php" qui lui aussi écrit ces balises ! Il y a donc au minimum un problème dans ton code...

Posté(e)
  • Auteur

J'ai trouvé, c'est l'index.php qui a des erreurs, c'est pas

<p><a href="includes/index.php?page=home">Home</a> que je dois mettre mais

<p><a href="index.php?page=home">Home</a>

.

==> Sentinel, c'est vrai ça, j'avais oublier qu'il fesait un copier coller.

Merci pour l'aide.

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.