buckeyestargazer Posted December 16, 2015 Share Posted December 16, 2015 Warning, I'm a complete newbie with very little coding experience. I'm creating a website with bootstrap using a wysiwyg front end, but I can also modify the code. I'm trying to create a bootstrap navbar that will be applied to each page in the website using php include on the server side. I have created "Navbar.php" that includes just the navbar, no css or anything. I have created a test page "test.php" with a simple paragraph. I'm placing the PHP code right after the <body>. The code I'm trying to use to pull "Navbar.php" into "test.php is: <?php include("Navbar.php"); ?> However, as soon as I save the page the code automatically changes to: <!--?php include("Navbar.php); ?--> This code is grayed out. Now at the same time, I am able to include a css in the "test.php" page and it styles the page just fine, using the php include: <style> <?php include("default.css"); ?> </style> What am I doing wrong with the navbar such that it won't show up on test.php? I don't know if this makes a difference, but the "Navbar.php" page is originally saved as an .html page by the bootstrap front end, which I then just changed the extension to .php. Quote Link to comment https://forums.phpfreaks.com/topic/299790-help-with-php-include/ Share on other sites More sharing options...
Ch0cu3r Posted December 16, 2015 Share Posted December 16, 2015 However, as soon as I save the page the code automatically changes to:<!--?php include("Navbar.php); ?--> This must be down to your editor. PHP will not change the source code for no reason. Can you explain how you are editing/saving your .php files? Quote Link to comment https://forums.phpfreaks.com/topic/299790-help-with-php-include/#findComment-1528072 Share on other sites More sharing options...
benanamen Posted December 16, 2015 Share Posted December 16, 2015 Definitely a problem with your "editor". Quote Link to comment https://forums.phpfreaks.com/topic/299790-help-with-php-include/#findComment-1528074 Share on other sites More sharing options...
buckeyestargazer Posted December 16, 2015 Author Share Posted December 16, 2015 This must be down to your editor. PHP will not change the source code for no reason. Can you explain how you are editing/saving your .php files? I figured as much. I'm using Pingendo. What I did was create the "Navbar" and "test" pages and had to save them as .html pages. Pingendo gives no option to save as php. Then I simply changed the .html extension to .php for both. I'm going to try editing the code in another editor and see what happens. Quote Link to comment https://forums.phpfreaks.com/topic/299790-help-with-php-include/#findComment-1528075 Share on other sites More sharing options...
benanamen Posted December 16, 2015 Share Posted December 16, 2015 (edited) Pingendo is not an editor, as it says on their site "app for Bootstrap prototyping". It is fairly new and still has code bugs that I informed them of long ago and had gotten response back that they would fix it yet they have not. It also uses some non standard Bootstrap CSS Classes, so you would have to use the modified Pingendo CSS . Edited December 16, 2015 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/299790-help-with-php-include/#findComment-1528076 Share on other sites More sharing options...
buckeyestargazer Posted December 16, 2015 Author Share Posted December 16, 2015 (edited) OK, like I said I'm a complete newbie... I believe the problem is that the navbar.php file has included <html> <body> <head> stuff that needs to be stripped out, which I did not know before. I'm going to give it a try just using notepad and see what happens. I also have dreamweaver but was using pingendo to easily build a responsive site. Edited December 16, 2015 by buckeyestargazer Quote Link to comment https://forums.phpfreaks.com/topic/299790-help-with-php-include/#findComment-1528078 Share on other sites More sharing options...
buckeyestargazer Posted December 17, 2015 Author Share Posted December 17, 2015 I got the include file Navbar.php properly sorted out, but the main problem is Pingendo. For some reason it changes the php include code to <!--?php include("Navbar.php"); ?--> on its own. I have to open the file in another code editor in order to properly format the include code, but when I did that everything worked as expected. Quote Link to comment https://forums.phpfreaks.com/topic/299790-help-with-php-include/#findComment-1528082 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.