hello my friends i have posted this article before but it stil didn't work so so i tried many time different way but i dont see the reason why my menu is not working.
in my main page template.php here is the content

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <head>
        <meta charset="utf-8"/>
        <link href='http://fonts.googleapis.com/css?family=Roboto:500,400' rel='stylesheet' type='text/css'>
         <script src="js/jquery-1.11.3.min.js"></script>
        <link href="header/header.css" rel="stylesheet" type="text/css">
        <link href="header/menuresponsive.css" rel="stylesheet" type="text/css">
        <link href="style/bodystyle.css" rel="stylesheet" type="text/css">
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/>
        <script type="text/javascriipt" src="header/fonctionmenu.js"></script> 
    </head>
    <body>
<div class="site-container">
    <div class="site-pusher">
    <?php include('../header/header.php'); ?> // i also tried include("../header/header.php")
        <div class="site-content">
            <div class="container">
                <!-- site content -->
                <h1>Lorem ipsum dolor sit</h1>
                <p>n. </p>
            </div>
            <div class="sidebar1">
        <p> sidebar1 </p>
        </div>
        </div>
        <div class="site-cache" id="site-cache">
        </div>
    </div>
</body>
</html>

and here is my header.php

<?php require_once('../Connections/agdb.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_principmenu = 10;
$pageNum_principmenu = 0;
if (isset($_GET['pageNum_principmenu'])) {
  $pageNum_principmenu = $_GET['pageNum_principmenu'];
}
$startRow_principmenu = $pageNum_principmenu * $maxRows_principmenu;

mysql_select_db($database_agdb, $agdb);
$query_principmenu = "SELECT * FROM apcategorie ORDER BY id ASC";
$query_limit_principmenu = sprintf("%s LIMIT %d, %d", $query_principmenu, $startRow_principmenu, $maxRows_principmenu);
$principmenu = mysql_query($query_limit_principmenu, $agdb) or die(mysql_error());
$row_principmenu = mysql_fetch_assoc($principmenu);

if (isset($_GET['totalRows_principmenu'])) {
  $totalRows_principmenu = $_GET['totalRows_principmenu'];
} else {
  $all_principmenu = mysql_query($query_principmenu);
  $totalRows_principmenu = mysql_num_rows($all_principmenu);
}
$totalPages_principmenu = ceil($totalRows_principmenu/$maxRows_principmenu)-1;
?>
  <header class="header">
            <a href="#" class="header__icon" id="header__icon" onClick="fonctionmrnu.js"></a>
            <nav class="menu">
                <?php do { ?>
                <a href="#"><?php echo $row_principmenu['categorie']; ?></a>
                  <?php } while ($row_principmenu = mysql_fetch_assoc($principmenu)); ?>
            </nav>
        </header>
  <?php
mysql_free_result($principmenu);
?>

What are the full pathnames of these files?

Are the two files in the same directory? the file thats required in the header file, whats the location?

you should check if the rendered page is as you expect to be
press control-u in browser and look if the source is right

open console and also verify if there are javascript|css error
when you get the origin of the error post it

Member Avatar

diafol

SHow us your directory structure and location of all relevant files

directory for all files in project to determine how to include php file.

screenshot.PNG these 4 code still not working there is no path error there is not error just it dont include (header.php) in the page

<?php include('../header.php'); ?>
<?php include("../header.php"); ?>
<?php include('../header/header.php'); ?>
<?php include("../header/header.php"); ?>
Member Avatar

diafol

As I thought.

Just do:

require "header/header.php";

this thing is blocking me a lot, i start to thing maybe it is a magic, bad luck.
Fatal error: require_once(): Failed opening required '../Connections/agdb.php' (include_path='.:/usr/lib/php5.4') in /homepages/0/d461548742/htdocs/agedepuce.com/header/header.php on line 1
then i trye "../header/header.php"
Fatal error: require(): Failed opening required '../header/header.php' (include_path='.:/usr/lib/php5.4') in /homepages/0/d461548742/htdocs/agedepuce.com/template.php on line 16

Rather than using relative links, you could also try using:

require_once($_SERVER['DOCUMENT_ROOT'] . '/Connections/agdb.php');

in the header.php file, and

require_once($_SERVER['DOCUMENT_ROOT'] . '/header/header.php');

in the template.php file.

Edit: actually, this may only work on Apache/Nginx servers, not sure if it would work on IIS.

Member Avatar

diafol

Hmm. Absolutes and relatives can have issues. Using __DIR__ can help avoid issues, especially "include includes" type problems.

You're right, but __DIR__ includes the current directory of the file you call it on.
It would probably be fine if the file you're calling the include on with __DIR__ is in the root directory, but if it's in a sub directory, and the file you're including is up a level, or in another sub directory, it can be a problem.