Menu system and fixed header that throws error

0

I got into a problem that can guide me from there (since I'm making my first weapons with the theme of web developments): I have a site that has a structure more or less like this:

  • "css" folder: files inside
  • "js" folder: files inside
  • "pages" folder: subfolders inside: files inside

then at the root of the site I have files like: index.php header.php menu.php page1.php pagina2.php pagina3.php etc ...

now ... I saw that doing the following, I managed to avoid repeating code:

 <header>
    <?php
        include 'cabecera.php';
    ?>
</header>

and in the body I put the following:

<?php 
    include 'menu.php';
 ?>

Now, when I want to apply the same routine with the pages that are in various other folders on the site, I get a 404 error !!! I think I have a problem with the links inside each of those files header.php and menu.php Any suggestions about it? Thank you very much

this is the header:

<div class="row">
    <div class="col-sm-5" id="bloque">
    <div class="container-fluid logo_mayor">
       <img src="images/logo.png" alt="Placeholder image" width="400" class="img-responsive center-block" class="cabecera"> 
     </div>
   </div>
   <div class="col-sm-4" id="bloque">
     <span class="align-middle" style="color: red">
      <h4 class="align-bottom" style="padding-bottom: 20px"><i><strong>Slogan de la página</strong></i></h4>
    </span>
   </div>

  <div class="col-sm-3" id="bloque">
   <?php
     include 'social.php';
   ?>
  </div>
</div>

this is the code of the menu:

<div class="container-fluid">
    <!--Si es administrador la barra de menu es negra -->     
    <nav class='navbar navbar-default'>
      <div class='container-fluid'>
        <div class='navbar-header'>
            <button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#navbar' aria-expanded='false' aria-controls='navbar'>
                <span class='sr-only'>Men&uacute;</span>
                <span class='icon-bar'></span>
                <span class='icon-bar'></span>
                <span class='icon-bar'></span>
            </button>
            <a class="navbar-brand" href="index.php"><img src="images/findergreen-iso.png" width="20"></a>
        </div>

            <div id='navbar' class='navbar-collapse collapse'>
                <ul class="nav navbar-nav">
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Menu<span class="caret"></span></a>
                      <ul class="dropdown-menu">
                        <li class="button"><a href="../abms/A/opcion1.php">opcion1</a></li>
                        <li class="button"><a href="#">opcion 1.5</a></li>
                        <li class="button"><a href="../abms/B/opcion2.php">opcion 2</a></li>
                        <li class="button"><a href="../abms/C/opcion3.php">opcion 3</a></li>
                      </ul>
                    </li>
                    <li><a href="login.php">Ingresar</a></li>
                    <li><a href="registro.php">Registrarse</a></li>
                    <li class="button"><a href="../abms/d/d.php">opcion D</a></li>
                    <li class="button"><a href="../abms/e/e.php">opcion E</a></li>
                    <li class="button"><a href="../forms/noticias/noticias.php">Novedades</a></li>

                </ul>
                <ul class='nav navbar-nav navbar-right'>
                    <li><a href='fundamentos.php'>Fundamentos</a></li>
                </ul>
           </div>
        </div>
    </nav>
    </nav>  
   </div>
    
asked by MNibor 13.06.2017 в 16:30
source

1 answer

0

You have said "various other folders". 404 error is because you are including a file that does not exist and is precisely menu.php or all other files that are not at the same level as the file in question.

I imagine with "various other folders" it would be like this:

css
js
paginas
    menu.php
    cabecera.php
    diversa_carpeta_1
       archivo_diverso.php <---- include '/menu.php';
    diversa_carpeta_2
       archivo_diverso2.php <---- include '/menu.php';
    
answered by 13.06.2017 в 16:36