helmut2509 Posted August 20, 2018 Share Posted August 20, 2018 When calling a page, I get the error (logged in /logs/errors.txt):"Cannot redeclare myfunction..(previously declared in...)" It seems there is a second declaration of this function, but where? I already added the namespace Processwire and switched off template compiling, but to no avail. (PW version 3.0.42) any ideas? Link to comment Share on other sites More sharing options...
dragan Posted August 20, 2018 Share Posted August 20, 2018 You should check your template file and all include-files (_init.php, _func.php or whatever you use). As the error msg says: you are re-declaring a function somewhere. With a good IDE you should be able to search across all files and spot it easily. 1 Link to comment Share on other sites More sharing options...
helmut2509 Posted August 20, 2018 Author Share Posted August 20, 2018 I checked the entire project folder: there is only ONE declaration of this function! Link to comment Share on other sites More sharing options...
bernhard Posted August 20, 2018 Share Posted August 20, 2018 you can get this error if you have only one declaration but you call it multiple times (eg by including it multiple times). maybe you have markup regions turned on? you could use tracy and a simple bd('test'); to see how often it is called. then you can inspect the backtrace: bd(debug_backtrace()); 4 Link to comment Share on other sites More sharing options...
Gideon So Posted August 20, 2018 Share Posted August 20, 2018 What is the function name. Is there any chance your function name conflicts with one of the Processwire function or one of the module's function? Gideon 1 Link to comment Share on other sites More sharing options...
Zeka Posted August 20, 2018 Share Posted August 20, 2018 @helmut2509 Also, do you use URL segments or call $page->render() somewhere? Link to comment Share on other sites More sharing options...
helmut2509 Posted August 20, 2018 Author Share Posted August 20, 2018 thanks. I guess the bug is most probably related to a multiple including of a script. Link to comment Share on other sites More sharing options...
adrian Posted August 20, 2018 Share Posted August 20, 2018 1 hour ago, helmut2509 said: I checked the entire project folder: there is only ONE declaration of this function! No use now that you have checked this, but an FYI for the future, the Tracy Template Resources panel shows you all functions and where they were defined. 1 Link to comment Share on other sites More sharing options...
helmut2509 Posted August 20, 2018 Author Share Posted August 20, 2018 I use $view->render , where $view is the instance of a template. 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