0

I am trying to move my navigation bar into an external php file. So far I have moved it over and names it "navigation.php" and saved it in my root directory.

When i try to call the navigation with my html page nothing appears?

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

Any help appreciated!

2 Answers 2

3

Change the name of your index.html file to index.php. Your index file actually is interpreted as HTML, not as PHP.

Sign up to request clarification or add additional context in comments.

3 Comments

+1. Alternatively, it is possible to configure the server to parse HTML files as PHP.
would this be the correct way to parse HTMl files as PHP? desilva.biz/php/phpinhtml.html
Do not parse html as php if you can avoid it. It's a slippery slope that leads to all kinds of problems.
0

is any other php code in your html page executed? if you just echo something, is it shown?

8 Comments

yeah, but you should try echo something instead of including the file. it's just for making sure that php code can be executed. if for example your html page has the ending htm than you could try changing it to .php
I've checked the server and php can be used
could you give us the piece of code, where the line is executed. maybe 3 or 4 lines before and afterwards
sure, my website it www.therisingsuntarporley.co.uk the navigation bar should show underneath the logo
Ive tried to follow these tips but seem to have got lost rpardz.com/blog/using-php-includes-global-navigation-links
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.