I’d like to display a snippet outside of Kirby’s templates in the header of PHP forum software which resides in a subdirectory on the server (Kirby in the root).
Unfortunately, this immediately shows an error when the snippet tries to display “$site->title()”. I’m assuming this is because it can’t find the site content or the base path of Kirby might be the subdirectory of the forum instead of the server root?
Just for clarification;
Kirby is in the root of the server, the forum software in /forums/.
I removed the last bit ($page->title()->html()) and it continues up to the next reference to $page so seems like $page is the issue, how would I fix that? Is there somehow to “fake” a page object and fill in the details?
You could just pass it page(), which will the refer to the home page (option 1); or you use an if statement in your header, that only tries to output the page title if $page is defined, which probably makes more sense.