benbyf Posted September 5, 2023 Share Posted September 5, 2023 I've not come across this before but in the default install for PW3.0.226 if you add some HTML into _main.php template file: <div id="content"> <?php // template code rendered here by PW ?> </div> and then add the same html container to the template named file e.g. home.php <div id="content"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mattis eros vitae metus sodales eget suscipit purus rhoncus. Proin ultrices gravida dolor, non porttitor enim interdum vitae. Integer feugiat lacinia tincidunt. Nulla laoreet tristique tristique. Sed elementum justo a nisl elementum sit amet accumsan nisi tempor. Nulla quis eros et massa dignissim imperdiet a vitae purus. </p> </div> when rendered I dont get double content containers but just one with the Lorem ipsum... What is this behaviour called??? Is there settings for it? Can it be disabled? confusing as hell. 2 Link to comment Share on other sites More sharing options...
da² Posted September 5, 2023 Share Posted September 5, 2023 Hi, This is called Markup Regions, it's targeted to ease templating (like Twig would do but only in PHP): https://processwire.com/docs/front-end/output/markup-regions/ If you use this, prefer to do it with the pw-region tag as it is better optimized (check the documentation). EDIT: I forgot to mention you can disable Markup Regions in site/config.php with $config->useMarkupRegions = false; Then you may also want to disable $config->prependTemplateFile if this file is no longer necessary. But if you want to use regions, you'll find in documentation that you can prepend/append/replace the _main.php tags with tags in templates, to solve the problem you are facing. 8 Link to comment Share on other sites More sharing options...
Robin S Posted September 5, 2023 Share Posted September 5, 2023 Those template files need a comment that explains what is going on. I opened a GitHub issue: https://github.com/processwire/processwire-issues/issues/1806 4 Link to comment Share on other sites More sharing options...
benbyf Posted September 6, 2023 Author Share Posted September 6, 2023 Super, thanks. I remember seeing this ages ago but then didnt use or realise it would be default behaviour.... so now I know ? 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