Jump to content

Very Very Simple Problem


Leng

Recommended Posts

This is my website:

 

www.wearenip.com/home.html

 

This is the menu that should appear on the left hand side, but doesn't:

 

www.wearenip.com/menu.php

 

This is my server's output saying that php is running just fine:

 

http://wearenip.com/phpinfo.php

 

I'm using this code in the left side bar div:

<?php include("menu.php"); ?>

 

The PHP file will not display from the HTML file no matter what I do.  I've tried using every possible combination of file linking including /menu.php  ./menu.php and even the full http://www.wearenip.com/menu.php etc etc etc

 

I'm genuinely upset about this.  Any help would be greatly appreciated.

 

PS:  I can't get any PHP file to properly include in any HTML file on any computer I have.  Nothing displays whatsoever regardless of what is in the PHP file, even if it's just a text word.  Doesn't matter if it's hosted on a PHP compatible internet server or just on a local server or just on the local machine itself.  Nothing.

Link to comment
Share on other sites

I've tried renaming the file home.php, I've tried making a NEW php file from scratch, making a NEW php file from DreamWeaver, I've tried everything on multiple computers and multiple servers and different kinds (Apache, etc) and can not get a single instance of

 

<?php include("menu.php"); ?> 

 

to work at all, period.  Has anyone else ever got this to work?  Every single website says this is all you have to do is include this one line of code in your HTML.  I've tried using 'menu.php', "www.wearenip.com/menu.php", 'www.wearenip.com/menu.php', literally HUNDREDS of combinations of computers, servers, browsers, etc.

 

I'm banging my head against the wall.  I can't get a single PHP script to run, even if it's as simple as ECHO'ing hello world.

Link to comment
Share on other sites

Look, all you have to do is go to:

 

www.wearenip.com/home.html

 

and click on "View page source" in your browser.  Look and see it even pinks out the one PHP line of code:

 

examplea.jpg

 

wtf?  That should have my menu in HTML form, not a pinked-out or greyed-out PHP code.

Link to comment
Share on other sites

But I've changed the names of all the files to end in .php instead of .html and the exact same thing happened, even when I refreshed the entire server and reloaded all the files (so they're only php) and refreshed on multiple browsers.

 

(D'oh, changing to php works when I allow the server to actually update.)

Link to comment
Share on other sites

That's exactly what I'm saying.  PHP should replace that line with the menu.php file located here:

 

www.wearenip.com/menu.php

 

Why is that not happening?  Thank you for your help.

 

PHP should not replace that line with anything unless it is contained within a file that the PHP interpreter has been specifically instructed to parse, such as those with a .php file extension. That file currently has a .html extension, thus it is being ignored.

 

EDIT: Create a copy of the home.html file, and save the copy with a .php extension.

Link to comment
Share on other sites

You are right Pikachu, I thought the server was properly configured to parse HTML files but it appears as if it wasn't.  I'll have to get my server admin to help me out with that.

 

Thanks a ton for figuring this out for me.  Much obliged!!

 

:)

Link to comment
Share on other sites

Whoops, sorry coupe-r!  Your solution was also correct, the only reason it didn't work when I tried it is because I didn't properly refresh the server.  *blushes*  Thanks a ton for helping me out.

 

I really thought this server's PHP was configured to parse HTML files

 

You guys rock!  :)

Link to comment
Share on other sites

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.