isellsoap Posted February 19, 2016 Posted February 19, 2016 PW 3.0.8 Setup: delayed output strategy with _main.php beginning with <?php namespace ProcessWire; ?><!doctype html> <html> <head> <meta charset="utf-8" /> <title><?php echo $page->title; ?></title> <link rel="stylesheet" href="<?php echo someFunction($config->urls->templates . "dist/app.css"); ?>" /> </head> In the _init.php file I include a _functions.php file with include_once($config->urls->templates . "_functions.php"); In _functions.php the someFunction is defined. The _init.php and _functions.php file begin with <?php namespace ProcessWire; Wenn I try to access the home page in the front-end I get this error: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Home</title> <link rel="stylesheet" href=" <p style='background:crimson;color:white;padding:0.5em;font-family:sans-serif;'><b>Error: Call to undefined function ProcessWire\someFunction() (line 8 of /some/path/site/templates/_main.php) </b><br /><br /><small>This error message was shown because: you are logged in as a Superuser. Error has been logged. </small></p> The setting in the home template at "Use compiled file?" is set to "Yes (and include files)". Why do I get this error?
szabesz Posted February 19, 2016 Posted February 19, 2016 How about include_once("./_functions.php"); ? $config->urls->templates returns a URL but you can only include a local file, so no need for this. 1
tpr Posted February 19, 2016 Posted February 19, 2016 Is _init.php file prepended to the template? See template settings in the admin and config.php.
isellsoap Posted February 19, 2016 Author Posted February 19, 2016 Thank you, szabesz. This is the answer.
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