It's that I have a code for a page in PHP and it has many windows, and well, it has a menu, but it's not generic, it's that the menu is seen in window 1 and well, normal, but that same menu has to be seen in window 2 and 3. so I have to write again all the lines of code for the menu, and they are like 300 does not make sense... to that add that there are 30 windows.
So what I want is to create a single menu, and each time I create a window, consume it, with that, if I make any changes, I don't have to do it to all 30 windows, but to just 1 file.
I don't know if I made myself understand
1. Use
include
orinclude_once
in php.Well, one option is to create a file
php
where you copy all the code of your Navigation and in all the other files (alsophp
), you simply callinclude_once '{archivo_con_navegacion.php}';
Example with
include_once
layout.php
dashboard.php:
This will display all of your html
layout.php
in whatever file you call<?php include_once 'layout.php'; ?>
2. Use a "Template Engine"
Another option would be to use a "Template Engine" like Twig