didhavn Posted June 1, 2016 Share Posted June 1, 2016 Hey all. Does anyone of you know why I can not call functions that are defined in _func.php? The file _func.php is included by the _init.php and if I just add an echo 'TEST'; to the _func.php, it is working. But when I add e.g. function print_test() { echo 'TEST'; } I get a Fatal error: Call to undefined function print_test() in ... on the page of the template calling this function. Does anyone of you have an idea what to change? Best, Lukas Link to comment Share on other sites More sharing options...
szabesz Posted June 1, 2016 Share Posted June 1, 2016 Hi,Are we talking about ProcessWire 3.x? Then it might be the namespace issue. The easiest way to fix it is to start all your template files, _func.php, _init.php, etc... with <?php namespace ProcessWire; More on this: https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/ 3 Link to comment Share on other sites More sharing options...
didhavn Posted June 1, 2016 Author Share Posted June 1, 2016 Thanks a lot, szanesz! You were absolutely right about the namespaces! 1 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