I am using a home.blade.php file in a new Sage9 theme installed last night. I used the composer start-project method described in the Sage installation instructions. I’ve created a Controller file called home.php and it contains this:
<?php
namespace App;
use Sober\Controller\Controller;
class Home extends Controller
{
public function what()
{
return 'weird';
}
public static function strange()
{
return 'strange';
}
}
$what doesn’t return anything, but the strange() method is working correctly.
I’m wondering why the what() method is not loading into the template correctly. I was able to create a method that did work that way in the included front-page.php controller file. Is the Home controller named incorrectly? Should I just add my methods to the FrontPage controller?
If you have both front-page.php and home.php in your controllers folder, looks like the front page controller takes precedence over the home controller, following the WordPress template hierarchy, even if you don’t have a front page template file.
Aaaaaaaah, ok. That works now. I was using the @debug(‘hierarchy’) tag but since I saw the app.php file I thought the rest of the files were getting loaded as well. I guess that means that only one of index.php, home.php, and front-page.php gets loaded into the template then. With the order or priority from the bottom of that list.