i am trying to create a website, a dynamic one.
i wanted to know if is any problem if i will not divide the index.php file, so it will have the header , footer, sidebar etc, in one file. is any thing wrong here? So instead having, header.php, index.php, footer.php, sidebar.php, i will create only index.php..
need some suggestions from experts please
Thank you for reading this post.
It’s almost always a good idea to split things up this. My typical “simple” site layout has a header, a footer, and a body, each with its own files. It’s rare for more than a couple pages to have different headers/footers, so almost every page ends up looking like:
And the header/footer files boil down to
<html><body>and</body></html>respectively (with all the usual css/javascript/meta/headers, etc… of course).Nothing wrong with keeping everything in a single file, but then you’d have to hard-code your menus/sidebars/footers/headers/etc… into every PHP file.