Custom block template not found when testing on production server.
PermalinkOn my Dev machine all my custom templates work flawlessly, for both my 5.6.x projects and 5.7.x
However once I upload the site(s) to my production server for testing, it seems concrete5 gets confused. Instead of looking in the standard override folder ([root]/blocks/autonav/templates/my-custom-template.php), it tries to load the template from the Core block folder and throws an error:
"failed to open stream, .../htdocs/concrete/autonav/templates/my-custom-template.php : no such file or directory" <-- rightfully so, the custom template is in [root]/blocks/autonav/templates/ not the core!
I've recreated this error with a fresh install of both 5.6.3.1 and 5.7.3.1 applying a custom template to a content block, having them both work perfectly on my Dev machine. and having them both fail on the production server with a similar error.
Dev machine:
# concrete5 Overrides blocks/autonav, languages/tr_TR, languages/it_IT, languages/da_DK, languages/fi_FI, languages/fr_FR, languages/nl_NL, languages/ru_RU, languages/ja_JP, languages/el_GR, languages/sl_SI, languages/de_DE, languages/sv_SE Block Cache - Off Overrides Cache - Off Full Page Caching - Off Full Page Cache Lifetime - Every 6 hours (default setting). # Server Software Apache/2.2.22 (Debian) # Server API apache2handler # PHP Version 5.4.36-0+deb7u3 # PHP Extensions apache2handler, bcmath, bz2, calendar, Core, ctype, date, dba, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, Phar, posix, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, zip, zlib. # PHP Settings
Production machine
# concrete5 Overrides blocks/autonav, languages/it_IT, languages/fi_FI, languages/da_DK, languages/sv_SE, languages/el_GR, languages/fr_FR, languages/nl_NL, languages/de_DE, languages/ja_JP, languages/tr_TR, languages/ru_RU, languages/sl_SI # concrete5 Cache Settings Block Cache - Off Overrides Cache - Off Full Page Caching - Off Full Page Cache Lifetime - Every 6 hours (default setting). # Server Software Apache # Server API fpm-fcgi # PHP Version 5.4.36 # PHP Extensions apc, bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mcrypt, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib.
I'm guessing it is related to a server configuration option, however I am at a loss of what it could be or where to start.
any help is appreciated, thanks
for 5.7.3.1
[root]/application/blocks/autonav/templates/my-custom-template/view.php
$nav = BlockType::getByHandle('autonav'); $nav->controller->orderBy = 'display_asc'; $nav->controller->displayPages = 'top'; $nav->controller->displaySubPages = 'relevant'; $nav->controller->displaySubPageLevels = 'all'; $nav->controller->blockViewRenderOverride = 'templates/my-custom-template/view'; $nav->render();
Could there be something security related in the PHP settings? I tried "Googling" but could find anything relevant.
Its almost as if the loader / namespace has been restricted to only "look" in the core.
Can anyone replicate my particular problem by uncommenting something from the standard view.php and seeing if it will show up from the override directory? Thanks!
- Edit -
I needed to put the custom template under application/blocks/ rather than the top level blocks/ folder to get the override to work
(the difference between those two folders and why they both exist is not yet totally clear to me)
Where are you putting your 5.7 custom block templates?