Reputation: 2787
I'm trying to understand the difference between the following. All of the reading I've done says that 'include' should work. I'm wondering 'why' I have to use the 'virtual()' and/or WHAT I'm doing wrong with the 'include'.
<?php virtual('/path'); ?>
and
<?php include'/path'; ?>
I use both in the code below. The 'virtual()' works and is used for header.php. The 'include' (does not work) and is used for footer.php. The code for the entire page is below. Link to live page
<head>
<title>Untitled Document</title>
<link href="/student_sites/2013/web_40/pages/css_includes/css_includes.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="header"><?php virtual('/student_sites/2013/web_40/pages/css_includes/assets/includes/header.php'); ?>
</div>
<div id="content_wrapper">Content for New CONTENT WRAPPER Div Tag Goes Here
<div id="side_bar">Content for New SIDE BAR Div Tag Goes Here</div>
<div id="content">Content for New CONTENT Div Tag Goes Here</div>
</div>
<div id="footer"><?php include '/student_sites/2013/web_40/pages/css_includes/assets/includes/footer.php'; ?></div>
</div>
</body>
</html>
Upvotes: 0
Views: 2717
Reputation: 11
<?php include'/path'; ?>
Doesn't work because of the type of file it's in. This statement must use the 'virtual()' which only works in php files. The 'include' only works in html or shtml files.
<!--#include virtual="/path" -->
for html files and
<?php virtual('/path'); ?>
for php files.
The html code still uses virtual but include as well, so I'm still not sure why it can't use include by itself.
-your 2ed period stutent
Upvotes: 1