Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.