I have this code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo $title; ?></title>
</head>
<body>
<?php foreach ($posts as $post) { ?>
<div class="post">
<h3 class="title"><?php $post["title"]; ?></h3>
<p class="text"><?php $post["text"]; ?></p>
</div>
<?php } ?>
</body>
</html>
And I need to include it in other file and execute all the PHP code in it. How can i do it?
Include with absolute path :
<?php include($_SERVER["DOCUMENT_ROOT"].'/yourdirectory/yourfile.php'); ?>