Jump to content

Recommended Posts

Posted

Just a quick one.

Is it possible to move my prependTemplateFile to a subdirectory with templates?

setting $config->prependTemplateFile = 'includes/_init.php' doesn't work for me

Posted

// prependFile: Filename to prepend to output, must be in /site/templates/. (default=$config->prependTemplateFile)

PageRender.module #302

$output->setPrependFilename($config->paths->templates . wire('sanitizer')->name($options['prependFile']));

It runs the value through $sanitizer->name which doesn't allow "/". So no it's not possible.

  • Like 2
  • 10 months later...
  • 4 years later...
Posted

This still seems to be the case in 2019... the files set in $config->prependTemplateFile and $config->appendTemplateFile must be in /site/templates/:
https://github.com/processwire/processwire/blob/649d2569abc10bac43e98ca98db474dd3d6603ca/wire/modules/PageRender.module#L362

If there's a way around this, I'd really like to know.

Note: Regular template file locations can effectively be anywhere with the hook mentioned in this GitHub issue:
https://github.com/processwire/processwire-requests/issues/204

 

 

  • Like 1
Posted

Don't know if that restriction makes sense at all. Could you just include('../yourfile.php'); in the prependTemplateFile?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...