Jump to content

Recommended Posts

Posted

I'm just trying to view a page, modal or popup. I can live with this error in the backend, but I'm afraid the underlying problem will manifest in other places also.

Fatal error: Uncaught Error: Call to undefined function ProcessWire\renderNav() in /home/amator/reader.romanga.ro/site/templates/basic-page.php:12 Stack trace: #0 /home/amator/reader.romanga.ro/wire/core/TemplateFile.php(287): require() #1 /home/amator/reader.romanga.ro/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #2 /home/amator/reader.romanga.ro/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___render', Array) #3 /home/amator/reader.romanga.ro/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #4 /home/amator/reader.romanga.ro/wire/modules/PageRender.module(536): ProcessWire\Wire->__call('render', Array) #5 /home/amator/reader.romanga.ro/wire/core/Wire.php(383): ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #6 /home/amator/reader.romanga.ro/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___renderPage', Array) #7 /home/amator/reader.romanga.ro/wire/core/Wire.php(450): ProcessWire\WireHooks->runHoo in /home/amator/reader.romanga.ro/site/templates/basic-page.php on line 12
Fatal Error: Uncaught Error: Call to undefined function ProcessWire\renderNav() in /home/amator/reader.romanga.ro/site/templates/basic-page.php:12

Stack trace:
#0 /home/amator/reader.romanga.ro/wire/core/TemplateFile.php(287): require()
#1 /home/amator/reader.romanga.ro/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render()
#2 /home/amator/reader.romanga.ro/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___render', Array)
#3 /home/amator/reader.romanga.ro/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
#4 /home/amator/reader.romanga.ro/wire/modules/PageRender.module(536): ProcessWire\Wire->__call('render', Array)
#5 /home/amator/reader.romanga.ro/wire/core/Wire.php(383): ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent))
#6 /home/amator/reader.romanga.ro/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___renderPage', Array)
#7 /home/amator/reader.romanga.ro/wire/core/Wire.php(450): ProcessWire\WireHooks->runHoo (line 12 of /home/amator/reader.romanga.ro/site/templates/basic-page.php)

This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.
Posted
4 minutes ago, kinderheim511 said:

(line 12 of /home/amator/reader.romanga.ro/site/templates/basic-page.php)

Please show us this line of code. Then we can give you some help.

Gideon

Posted

This is the entire code in that file, line 12:     $content .= renderNav($page->children);

<?php namespace ProcessWire;

// basic-page.php template file 
// See README.txt for more information

// Primary content is the page's body copy
$content = $page->body; 

// If the page has children, then render navigation to them under the body.
// See the _func.php for the renderNav example function.
if($page->hasChildren) {
	$content .= renderNav($page->children);
}

// if the rootParent (section) page has more than 1 child, then render 
// section navigation in the sidebar
if($page->rootParent->hasChildren > 1) {
	$sidebar = renderNavTree($page->rootParent, 3) . $page->sidebar; 
}
Posted

The error shows you are missing the function renderNav().

It looks like you are using one of ProcessWire's site profiles it ships with. The renderNav() function is in the file /site/templates/_func.php. I am assuming that file is in your install otherwise PHP would have thrown an error about the missing file in the file /site/templates/_init.php. That is where the _func.php is included.

Do you have _init.php? If yes, in your template settings for basic-page, did you maybe change the setting for Prepend File? This is found in /setup/template/edit?id=xxxx , on the tab Files. Did you maybe tick Disable automatic prepend of file: _init.php?

Posted

I guess that's the problem, I don't have any renderNav function inside /site/templates/_func.php

I did not change any settings, Prepend File is empty and the Disable automatic prepend of file: _init.php is unchecked.

I'm attaching the files.

 

_init.php _func.php

Posted (edited)

I see what's going on now.

Did you inherit the site maybe? Or another developer was working on it? in your _func.php, there is a function called menuBuilder(). It seems that is what is/was being used in the site instead of renderNav(). So I guess it's a question of how you want to proceed. If you want to use the menuBuilder() function, you can do that and remove references to renderNav(). If you want to use renderNav() instead, you can find the full function here: https://github.com/processwire/processwire/blob/master/site-default/templates/_func.php. In that case you will have to edit your _init.php as well since menuBuilder() is included there as well as some other custom code.

Edit

You could also use both functions depending on your needs.

Edited by kongondo
clarification
Posted

It was a clean install, I just added some modules, can those write inside _func.php?

I have no idea what would happen if I removed menuBuilder() so I've just added the renderNav() function in _func.php and the error is gone. 

Is this ok?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...