ridgedale Posted May 8, 2017 Share Posted May 8, 2017 Hi, I've separated the header and footer information from the _main.php (_header.php and _footer.php). This works fine with any top level page but any page children are rendered without the header and footer information. When I add includes to the blog-post.php, for example, and try refreshing the page the following error is returned: Quote Fatal error: Call to undefined function ukBlogPost() in /<path to site folder>/site/assets/cache/FileCompiler/site/templates/blog-post.php on line 8 Error: Call to undefined function ukBlogPost() (line 8 of /Users/dene/Desktop/WebSrv/devDLF2/site/templates/blog-post.php) The line of code being referred to is: echo ukBlogPost(page()); Could this error be being generated because I am working locally using MAMP? Any assistance would be greatly appreciated. Link to comment Share on other sites More sharing options...
Zeka Posted May 9, 2017 Share Posted May 9, 2017 Hi @ridgedale It looks like namespace issue. Try to add namespace Processwire; to the top of your blog-post.php file 1 Link to comment Share on other sites More sharing options...
ridgedale Posted May 9, 2017 Author Share Posted May 9, 2017 Hi Zeka, Thank you for your reply. That appears to be getting somewhere as some of the child pages are now displaying OK. However, the blog-post pages and now the contact page are generating the following same error: Quote Notice: Undefined variable: home in /<path to site folder>/site/templates/_header.php on line 60Fatal error: Call to a member function and() on null in /<path to site folder>/site/templates/_header.php on line 60 Error: Call to a member function and() on null (line 60 of /<path to site folder>/site/templates/_header.php) The line of code referred to is as follows: <?=ukNavbarNav($home->and($home->children), [ That code has not been modified from the site-regular profile. It's a bit odd as all the pages load that code and it now appears that just the blog-post and contact pages throw up that error message. Update: Adding the following line after namespace Processwire; code $home = pages()->get('/'); // homepage gets rid of the error message but the blog-post pages are still not rendering properly. The pages now appear to be rendering twice and all the margins are messed up. Any advice would be appreciated. Link to comment Share on other sites More sharing options...
ridgedale Posted May 11, 2017 Author Share Posted May 11, 2017 Update: The blog-post.php page rendering issue was resolved by removing the _header.php and _footer.php includes. Thanks again to Zeka for his initial assistance. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now