OriginalSunny Posted March 11, 2006 Share Posted March 11, 2006 Hi,When using my webpage everytime a link is clicked on, a totally new page is opened. I want it so that the navigation bar is always displayed on the side of the page no matter what the user is doing. Currently i am using the following code for the navigation bar:[i]<a href="contact.php">Contact Us</a><br><br><a href="accessories.php">Accessories</a><br><br>[/i]As you can see the menu page is in html and some of the other pages are also in html or in php. Currently whenever a page is clicked on the navigation bar dissappears and a new page is created. How do i do it so that the navigation bar always stays on the side?? Quote Link to comment https://forums.phpfreaks.com/topic/4704-how-to-open-links-to-pages-correctly/ Share on other sites More sharing options...
AndyB Posted March 11, 2006 Share Posted March 11, 2006 I hope you don't mean a new browser window for every link!The simplest solution would be to use the include() function to add your menu to every page. Then changing your menu would automatically update all your site's pages. Quote Link to comment https://forums.phpfreaks.com/topic/4704-how-to-open-links-to-pages-correctly/#findComment-16473 Share on other sites More sharing options...
OriginalSunny Posted March 11, 2006 Author Share Posted March 11, 2006 I dont mean a new browser for every link. I have tried the include() function and it does work, however depending on where i put it, the menu bar page comes up either above or below the other page. The way i want it, the menu bar should come up on the left of the other page which is opened (like on this phpfreaks website).Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/4704-how-to-open-links-to-pages-correctly/#findComment-16478 Share on other sites More sharing options...
AndyB Posted March 11, 2006 Share Posted March 11, 2006 Save this (and nothing more) as menu.php[code]<a href="contact.php">Contact Us</a><br><br><a href="accessories.php">Accessories</a><br><br>[/code]Then when you want the menu to show on any page, place this exactly where you want your menu to appear:[code]... blah blah blah page stuff<?php// add my menuinclude("menu.php");?>... blah blah blah more page stuff[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4704-how-to-open-links-to-pages-correctly/#findComment-16490 Share on other sites More sharing options...
robcrozier Posted March 11, 2006 Share Posted March 11, 2006 Why don’t you use frames?You could create a navigation frame with the links on and when those links are accessed the new page content is displayed in the main frame of the page. It would be like having your page split into two.The code you would use to make the links appear in the new frame would be [code]<a href="contact.php" target="MAIN_FRAME">Contact Us</a><br><br><a href="accessories.php" target="MAIN_FRAME">>Accessories</a><br><br>[/code]Obviously you would substitute the MAIN_FRAME target to whatever you call your frame!I know it doesn’t use php but it’s by far the easiest way to do what you’re doing! Quote Link to comment https://forums.phpfreaks.com/topic/4704-how-to-open-links-to-pages-correctly/#findComment-16517 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.