Forum

Thread tagged as: Problem, Error
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. What's the difference between the templates?

Drew, I finally figured this out. It took several hours of building each master page one piece at a time to see what was causing the issue. But, after rebuilding the master page templates and not getting any errors at root level I still couldn't figure it out. It didn't make sense. If a page works at one level without error, why did moving it to another sub-directory cause it to display blank?

So, I started with your default master page. Created a page in the root directory and it was fine. Moved it to the /en/index.php directory and it was fine. Took all of my code copied it and pasted it into the default.php master page. Then created a page, placed it into the /en/page.php directory and it worked, perfectly.

I then took all that same code pasted it into my en_interior_free_form.php master template and created a page. Placed that page into the /en/ directory and experienced the same problem ... a blank page. However, move it to the root directory and it worked perfectly. So, what could the problem be? If the code works on your default template and all that SAME code is copied and pasted into the en_interior_free_form.php and I get a blank page what's the difference?

The master template name!!!! If I kept all the code the same and simply changed the master template name from en_interior_free_form.php to en-interior-free-form.php (dashes not underscores) and used that master page template to create a page in the /en/ directory the page displayed properly!!!

So, apparently, perch doesn't like when you use underscores in your master page template names. Perhaps this is a bug I uncovered? Or perhaps its the way it was designed to work, I don 't know. But, I couldn't find anything on the perch site about naming conventions for page templates. Did I miss that? Because it took me over a week to find the solution to this as you can see from the date of my original post here.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's interesting. I don't think there should be any problems with underscores, but I'll test it.

OK, I didn't think there should be either, but that was the difference between a happy me and a bald me (from pulling my hair out) ;-) When using underscores the path to perch on pages in the subdirectory gets written as follows:

<?php include(str_replace('/', DIRECTORY_SEPARATOR, 'perch/templates/pages/en/en_Interior_free_form.php')); ?>

when I use dashes the path gets written as:

<?php include(str_replace('/', DIRECTORY_SEPARATOR, '../perch/templates/pages/en/en_Interior_free_form.php')); ?>