Violet Posted April 20, 2019 Share Posted April 20, 2019 (edited) I know that we can disable the append of _main.php by clicking the box in the template file. However, is there a way to disable it by default, so that new templates created do not append _main.php? For those of us that never use _main.php, it's something that needs to be clicked every time a new template is created. Not a big deal, but is there a way to set it up in the settings to default to NOT appending? I tried different searches on the forum and haven't come up with anything yet. I understand more the default automatic prepend of _init.php because most people have variables to populate there before the rest of the page loads. Anyway, if there is no solution to my question, it's a minor thing, but thought I'd ask as I'm in the process of moving several of my sites to ProcessWire and this is a question that I think of often. Edited April 20, 2019 by Violet Marked as solved Link to comment Share on other sites More sharing options...
dragan Posted April 20, 2019 Share Posted April 20, 2019 Either add $useMain = false; to your templates, and / or alter your site/config.php file: $config->appendTemplateFile = ''; 1 Link to comment Share on other sites More sharing options...
Violet Posted April 20, 2019 Author Share Posted April 20, 2019 Wow! This is perfect! ? Thanks for the different options of solutions you offered @dragan. I will go with this one you suggested: 8 minutes ago, dragan said: $config->appendTemplateFile = ''; I am about to switch over one of my other sites. Am thrilled that with altering 1 line in the .config file I will save some clicking, and to be honest it's not just the clicking; I forgot to do it on one template, and then it took me awhile to figure out what was the problem when the rendered page looked weird. So this will save me quite a bit of time. Thanks again! Link to comment Share on other sites More sharing options...
dragan Posted April 20, 2019 Share Posted April 20, 2019 You can also change settings via API: $tpl = $templates->get("location"); $tpl->noAppendTemplateFile = 1; $tpl->appendFile = ""; $tpl->save(); 3 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