Copy link to clipboard
Copied
Estoy haciendo un sitio, y a la hora de poner menú y pie de página los retiro en archivos aparte y los meto en una carpeta llamada constructores. Luego copio el código HTML del index original a cada fichero y borro el original, poniendo los includes. Pero no coge la hoja de estilos ni el javascript. ¿Por qué? Creo que es algo de las ubicaciones pero no lo entiendo muy bien. (Creo haberme explicado bien)
Include files should not contain links to JS or CSS files. Those links go inside the <head> tag of your parent document.
Include files are for the relevant menu & footer code only.
Examples:
<nav>
<ul>
<li><a href="page1.php">Link 1</a></li>
<li><a href="page2.php">Link 2</a></li>
<li><a href="page3.php">Link 3</a></li>
</ul>
</nav>
<footer> © 2017. XYZ Website. </footer>
Copy link to clipboard
Copied
When you include a file, your are placing its contents into the main document. If the main document resides in the root directory, then the associated CSS and JS files should be linked relative to the root directory.
As an example, my builders/includefile.html has a link to ../css/mystyles.css. This will not work once the code is included into the main document, this should read css/mystyles.css
Hopefully, I have explained it properly.
Copy link to clipboard
Copied
Pero ¿cómo modificar el código en el principal si solo tiene un include al includefile.html?
Copy link to clipboard
Copied
The link in the include file needs to be adjusted.
Please give me the code for the include file and I will show you exactly what to do.
Copy link to clipboard
Copied
Include files should not contain links to JS or CSS files. Those links go inside the <head> tag of your parent document.
Include files are for the relevant menu & footer code only.
Examples:
<nav>
<ul>
<li><a href="page1.php">Link 1</a></li>
<li><a href="page2.php">Link 2</a></li>
<li><a href="page3.php">Link 3</a></li>
</ul>
</nav>
<footer> © 2017. XYZ Website. </footer>