I tried putting this "Last Modified" piece into a function so I can call it via one function name instead of having to include all of this code in my HTML file. I want the PHP code in the Controller file.
Code via my PHP Controller
function lastModified()
{
$filename = 'index.php';
if (file_exists($filename))
{
echo "$filename was last modified: " . date ("F d Y H:i:s.",filemtime($filename));
}
}
Code via my HTML File
<div id="footer">
<p><a href="/php/day%207%20code/before/addjoke/">IDJB Home</a> - <a href="?addjoke">Add Joke to IDJB</a> - <a href="#">Sitemap</a></p>
***LINE 36*** <p>© <?php echo date("Y") ?> Internet Joke Database</p> <?php echo $lastModified() ?>
</div>
I'm getting the following errors: I marked line 36 in form.html.php.
1.) Notice: Undefined variable: lastModified in C:\wamp\www\php\day 7 code\before\addjoke\form.html.php on line 36
2. ) Fatal error: Function name must be a string in C:\wamp\www\php\day 7 code\before\addjoke\form.html.php on line 36