0

I have seen several posts but I haven't really got around it.

I am finding out PHP is a lot more useful than I thought so I'm trying to use it as much as possible for its flexibility to modify content from a single file.

Can I include the contents of <head> tags inside a php file and then insert it to the html?

like...

<html>
<?php include("head_contents.php"); ?>

<body>
blablabla
</body>
</html>

By the way, would the metatags be included in that head_contents.php as they are usually typed directly into the HTML file?

I will appreciate actual code shown if I am wrong.

Thank you!!!

3
Contributors
2
Replies
5
Views
6 Years
Discussion Span
Last Post by G&G Designing
0

Here is what i do whenever im doing a sort of template system for clients. Forgive me if there are some errors.

<!-- Head.php -->

<html>
<head>
<!-- All your head links and stuff -->
</head>

<!-- End Head.php -->




<!-- Header.php -->
<body>
<h1> This is the header </h1>
<ul>
	<li>Menu 1</li>
	<li>Menu 2</li>
	<li>Menu 3</li>
</ul>
<!-- End Header.php -->




<!-- Footer.php -->
<div id="footer">
	<h3>&copy; my site | all rights reserved </h3>
</div>
</body>
</html>
<!-- End Footer.php -->




<!-- index.php (main page) -->

<?php include('Head.php') ?>
<?php include('Header.php') ?>

<h1> Any main section content.. like blog posts or a form or something that doesn't change. </h1>

<?php include('Footer.php') ?>
<!-- end index.php -->
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.