Manaus Posted July 22, 2021 Posted July 22, 2021 As far as I know there are these two methods: adding it to each templates via the 'Files' tab, or including it on every .php template file. Are there other ways? Thanks
cjx2240 Posted July 22, 2021 Posted July 22, 2021 In your config.php $config->prependTemplateFile = '_init.php'; 3
Webrocker Posted August 12, 2021 Posted August 12, 2021 this file then needs to be in site/templates/, so site/templates/_init.php (but can be named anything you want) the cool thing is, you can still decide on a individual template setting level (under templates -> edit -> files) to NOT prepend this file, or to prepend a different file. Same goes for $config->appendTemplateFile, where you could state an always after the template file. see https://processwire.com/api/ref/config/ -> "Template files" 1
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