I want something like Wordpress's system. I want to get header code from header.php so I will not have to edit all of the pages when I'm going to edit something.
Asked
Active
Viewed 29 times
0
-
1You want to [include](http://php.net/manual/en/function.include.php) some code? – Aug 21 '15 at 14:42
-
possible duplicate of [What is the difference between PHP require and include?](http://stackoverflow.com/questions/3626235/what-is-the-difference-between-php-require-and-include) – drmarvelous Aug 21 '15 at 14:48
1 Answers
1
You can never get the code because one the php page is render, it gets converted into HTML so you will always see html.
I understand, you need header component.
1)Create a file header.php (add navigation bar or logo or whatever you want).
2)Include it in other php files as include("header.php");
so all the pages will be using this one header.php
file and you can modify it and the changes would get reflected all over the web app.

Danyal Sandeelo
- 12,196
- 10
- 47
- 78
-
-
include is a php function so you will have to open the tags to use it.. – Danyal Sandeelo Aug 21 '15 at 14:57