Jump to content

PW3 - Children Rendering Incorrectly


ridgedale
 Share

Recommended Posts

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

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 60

Fatal 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...