Can’t Get a Template to Load from File
EE Insists on loading from the database
If, like us, you prefer editing your templates using a text editor then it can get frustrating if EE then insists on only loading templates from the database and ignores our carefully crafted files.
When you navigate to your templates in the CP via Design -> Templates -> Template Manager and then select one of your templates you'll see that EE displays "from database" above the template code.
There are two posible problems which have affected us:
1. The templates path is incorrectly set.
Navigate to Design -> Templates -> Global Preferences and check the value of "Server path to site's templates". Now we like to set this to a relative path so that we can move databases easily between dev, staging and live. However for some reason this just doesn't work every time (we suspect it may be related to the version of EE in use). Try putting in the full server path to the templates durectory.
If you're on Windows then you can put in the full server path using forward rather than back slashes. if you use back slashes EE will replace them with forward slashes anyway. The good news is that Windows doesn't mind which way your slashes point.
2. Check the Template File's Time Stamp
We ran in to this one after a lot of head scratching and swearing that our template path was correct. If the time stamp on the template file is older than the time stamp in the database then EE will load the template from the database. Edit and re-save the file. Also, beware of FTP software which stamps files with an incorrect time - ours was an hour out with the server time when we had this problem.
Another issue with FTP is that you can configure your FTP client to preserve the dates and times of the files you upload. If your FTP software is set to do this then it is possible that your uploaded files won't be date stamped with the date and time of upload and will display the date and time of your last edit instead.
Expression Engine Tips and Tricks
ExpressionEngine is a Content Management system which is highly flexible. Why not give it a try?
- ExpressionEngine White Screen of Death
- Field Types Trick when Upgrading ExpressionEngine from 2.x to 6.x
- Getting Captcha Working
- ExpressionEngine upgrade 2.7.1 to 2.9.0
- Transcribe tips
- Using SafeCracker with AJAX and Solspace Calendar
- Creating Navigation Using Structure
- CP Loses Its Styling
- Thumbnails aren't Created in EE on a Windows Installation
- Can't Get a Template to Load from File
- How to Remove index.php on IIS
- File Cannot Be Written To Disk
- Error 500.0 Internal Server Error
- Unable to Load Site Preferences
- Your Config File Does Not Appear to be Formatted Correctly