User Tools

Site Tools


Sidebar

designers:template_error

This is an old revision of the document!


Oops! Template Error! How to Fix

If you get this error:

Oops! Template Error! Please pardon our dust as we work to update the site...

That indicates a problem with one of your templates. When this error is generated, it will e-mail the details to your admin e-mail so that you can easily fix it. Check your e-mail (the e-mail address filled in, in your admin e-mail settings), and look for the e-mail with a subject of:

Automated Admin Notice: TEMPLATE ERROR!

The e-mail will look something like the below.

Sample E-Mail Contents

From: [email protected]

To: [email protected]

Subject: Automated Admin Notice: TEMPLATE ERROR!

Message:


You are receiving this because a template error was generated on your site:
http://example.com/index.php

See below for template error details:

Full URL: http://example.com/index.php

Template Set: my_templates
Template Type: main_page
File: head.tpl
Line: 26
Template Code:
<div>{addon </div>


Error Message: Syntax Error in template "geo_tset:my_templates:main_page:head.tpl" on line 26 "<div>{addon </div>" - Unexpected "/"


DEBUG INFO: See below for full environment information to help troubleshoot.

Full Error & Backtrace:
exception 'SmartyCompilerException' with message 'Syntax Error in template "geo_tset:my_templates:main_page:front_page.tpl~"  on line 2 "{php}echo 'howdy!';{/php}" unknown tag "php"' in /var/www/ca_ent_trunk/classes/php5_classes/smarty/sysplugins/smarty_internal_templatecompilerbase.php:621
Stack trace:
#0 /var/www/ca_ent_trunk/classes/php5_classes/smarty/sysplugins/smarty_internal_templatecompilerbase.php(402): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "ph...', 2)
........
...

The rest of the e-mail has not been included for brevity1)

How to Fix

The only part you need to read, is the stuff in the big red box. Everything else is "extra" for the rare times when the info in the red box is not enough, it may be needed by support. But those times are rare, usually you can see what the problem is by simply looking at the error details in the big red box.

Now, say you got the e-mail contents from Sample E-Mail Contents above. Just read the contents of the red box. In this case, you know that the "template set" it is happening in, is my_templates. And you know this is happening in a main_page template. The specific template file the error occurs in is head.tpl, on line 26. It even shows you the actual line in question with the error.

If the problem is not obvious to you just by looking at the Template Code line it shows with the error in it, read the actual error message. In this case, it states "Syntax error …" and ends with "- Unexpected /". In the error message, the first part and the last part are usually the parts that say what the problem is. So we know there is some syntax error, that there is an "unexpected /". If you look at the line listed, you will see the {addon but it looks like the rest of the smarty tag is missing. There is the problem! Most likely either the addon tag was partially added but is missing the end, or someone may have tried to remove the tag but only removed part of the tag.

The "fix" would be to remove the partial smarty tag from that line, OR complete the tag with the full Smarty tag that is supposed to be on that line. Note that this is just an example, obviously the same fix will not apply to all situations, it would only apply if your error line happened to look like the one in the example.

1)
Plus you only need what is listed in the big red box, the rest you can usually just ignore.
designers/template_error.1375666330.txt.gz · Last modified: 2014/09/25 16:55 (external edit)