skip to Main Content

on my site the topbar, menu and footer as php include instruction in html, is not working for the *.html files
only the index.html

In the chrome inspector i see that de php include is shown as command!
when is rename the agenda.html -> agenda.php the php_menu, php_topbar and php_footer are working again

in the past i have to put a "addhandler" in the ".htaccess"

How can i make al html to run as a php


index.html

<!--Top bar start-->
<?php
    include 'php_topbar.php';
?>

php_footer.php

https://www.sportenmoedig.be/php_footer.php


php version:
https://sportenmoedig.be/version.php

Current PHP version: 7.3.23


.htaccess

AddHandler application/x-httpd-php .php .htm .shtml .html


2

Answers


  1. You can’t use <?php ?> tags in html page, <?php ?> working only in php file. You can change index.html to index.php

    Login or Signup to reply.
  2. The opening of PHP script is <?php and the closing will be ?>

    Outside of these tags, you will be able to insert your html. This means that any page that you want to use PHP in you should name a .php file.

    This source will help you understand how PHP and HTML can be used together:

    https://www.w3schools.com/php/php_syntax.asp

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search