Your include Tags are Not being rendered, because you're not using the template class... Try
echo Template::instance()->render('landing.htm');
Instead of View
Question
I finished a simple project with F3 (fat free framework) 2.0 and everything worked great. Now I'm starting a new project and I see it's been changed quite a bit. I've created a simple basic test and just keep hitting error's and weirdness. I'm no expert with F3 and yes I've read the documentation and yes of course I probably missed something. Hoping someone can help me. Here's my example that fails:
Start with my config file
cfgDbConnection="mysql:host=localhost;port=8889;dbname=test";
cfgDbUser="root"
cfgDbPassword="123456"
cfgCache=true
//...etc
The starting point
$f3=require('lib/base.php');
$f3->set('UI','ui/');
$f3->set('AUTOLOAD', 'classes/'); // this folder contains class objects for the project
$f3->config('config.cfg');
$f3->set('CACHE', $f3->get('cfgCache'));
$f3->set('DEBUG',3);
$db = new DB\SQL(
$f3->get('cfgDbConnection'),
$f3->get('cfgDbUser'),
$f3->get('cfgDbPassword')
);
$f3->set('DB',$db);
require_once("menuRoutes.php");
$f3->run();
The first of 5 php files for routing
<?php
$f3->route('GET /', function() use ($f3){
AuthManager::authenticateSession($f3); // checks if user is logged in /classes/AutManager.php
echo View::instance()->render('landing.htm');
});
<include href="mainHeaderBar.htm"/> (this has css & js loads)
general html.......
<include href="mainFooterBar.htm"/> (other jquery scripts)
At this point page loads the general html, CSS and JS scripts are not loading because the includes are not loading, they are being ignored.......?
PHP Log shows:
HTTP 405 (HEAD /)
/Users/home/Documents/My Projects/testApp/web/index.php:39 Base->run()
ob_clean(): failed to delete buffer. No buffer to delete
/Users/home/Documents/My Projects/testApp/web/lib/base.php:859 ob_clean()
/Users/home/Documents/My Projects/testApp/web/lib/base.php:1118 Base->error(405)
/Users/home/Documents/My Projects/testApp/web/index.php:39 Base->run()
PHP Fatal error: Uncaught exception 'ErrorException' with message 'ob_clean(): failed to delete buffer. No buffer to delete' in /Users/home/Documents/My Projects/testApp/web/lib/base.php:1391
Thanks for the help/advice.
Solution
Your include Tags are Not being rendered, because you're not using the template class... Try
echo Template::instance()->render('landing.htm');
Instead of View