Jump to content

Including a Menu Code


ballouta

Recommended Posts

Hello

 

I have a big menu generated from my DB using a PHP code...

every time i modify this menu i have to copy all the menu code to all other pages which is waste of time.

 

is there anyway to put this PHP code in a separate time and 'echo' its content whenever i want from another pages?

How?

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/146747-including-a-menu-code/
Share on other sites

so I put my menu code in a file e.g. menu.php

 

and i use this line of code to include it in another pages?

 

include('menu.php');

 

But how do print this file content in the page included?

 

 

All the print statements should be in menu.php, the include will execute the code in the menu.php file like the code was on that page to begin with. Give it a try and mess around with it to see how it works.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.