helmut2509 Posted April 12, 2017 Share Posted April 12, 2017 In one of my templates I had a function and as this function serves also general purposes I saved it in an external functions.php. This functions.php was included_once in the template. But then I got an error: Cannot redeclare function.. previously declared in /var/www/..../site/assets/cache/FileCompiler/site/templates/ I deleted this cache folder, but to no avail :-(( So for the moment I see no other solution than to put again the function into the template file... Any suggestions? Link to comment Share on other sites More sharing options...
Zeka Posted April 12, 2017 Share Posted April 12, 2017 Hi! Can you try to use $config->paths->templates in your include_once. 1 Link to comment Share on other sites More sharing options...
helmut2509 Posted April 12, 2017 Author Share Posted April 12, 2017 3 minutes ago, Zeka said: Hi! Can you try to use $config->paths->templates in your include_once. to what avail? the file functions.php apparently exists and is being loaded. Link to comment Share on other sites More sharing options...
szabesz Posted April 12, 2017 Share Posted April 12, 2017 Any chance it being a namespace issue? eg.: Link to comment Share on other sites More sharing options...
helmut2509 Posted April 12, 2017 Author Share Posted April 12, 2017 3 minutes ago, szabesz said: Any chance it being a namespace issue? eg.: The cache status of all templates is already set to "disabled". What do you mean by *namespace issue*? What do I have to check? Link to comment Share on other sites More sharing options...
szabesz Posted April 12, 2017 Share Posted April 12, 2017 You can find out more about namespaces in ProcessWire 3.x here: https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/ If you cannot figure it out, please provide some more details of your template setup. 1 Link to comment Share on other sites More sharing options...
Zeka Posted April 12, 2017 Share Posted April 12, 2017 4 hours ago, helmut2509 said: to what avail? the file functions.php apparently exists and is being loaded. Sorry if my answer was not relative to your problem. The main reason why I supposed it to you was the fact that I had the very similar issue some time ago. The problem was that my template files had been compiled into several folders and to solve it I had to use $config->paths->templates . "file" 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