neonwired Posted May 30, 2019 Posted May 30, 2019 I read somewhere that you could use $page->render('emails/base.php') to render a page using a specific template. However it doesn't seem to be working, it's still trying to use _main.php. Not sure what the expected behavior of this is or if i'm doing it wrong,
bernhard Posted May 30, 2019 Posted May 30, 2019 Likely _main.php is being appended automatically: https://www.google.com/search?q=site:processwire.com+appendtemplatefile 1
wbmnfktr Posted May 30, 2019 Posted May 30, 2019 Either what @bernhard said or your path is wrong. The last is the main thing I'm struggling quite often with. When I get my paths right it works as expected. Even with things from repeater/repeater matrix items. 1
neonwired Posted May 31, 2019 Author Posted May 31, 2019 I think the path is correct. It should be relative to site/templates, right? It does look like the config appends it was $config->appendTemplateFile = '_main.php'; Not sure how you get around this.
wbmnfktr Posted May 31, 2019 Posted May 31, 2019 It should. My example above will therefore look in /site/templates/_view/FILE.php - this works in about 99% of all cases. Sometimes... I don't know why it doesn't. In those rare cases I have to write render("./_view/..."). and need to add this ./ before the path.
neonwired Posted May 31, 2019 Author Posted May 31, 2019 Found the answer to the config appending _main.php using the $useMain variable as suggested in this thread. Thanks for everyone's help.
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