How can I bring php into my html files and where do i store the php files? [closed]

StackOverflow https://stackoverflow.com/questions/12888440

  •  07-07-2021
  •  | 
  •  

سؤال

I am very new to web-development and I apologize for a question that may appear silly.

I am using expression web to create most of the cosmetics of my website and I am using php for the coding. I already have resources and have learned about php but i"m new to implementing it. I want to be able to have specific parts of my site generated by php code. For example, the login box and the user profiles. How do I make my html files use those files to generate content and where do I put the php files that the html page will use? Thanks in advance!

هل كانت مفيدة؟

المحلول

The easier way is to have a separate PHP file for everything you want like: loginBox.inc.php, header.php, etc. Then change your html page to php (just the extension), then wherever you want to add the login box, just do:

<?php include ('loginBox.inc.php') ?>

And all php code from that file will be include. I think this is what you want. For better code maintaing, put all those files in a folder called includes or something similar to organize files in a better way.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top