Jump to content

Recommended Posts

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.  

 

Link to comment
https://forums.phpfreaks.com/topic/299790-help-with-php-include/
Share on other sites

 

 

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?

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.

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 by benanamen

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 by buckeyestargazer
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.

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.