0

When I view the Synchronize Templates page, some of my templates consistently show "No file exists" instead of the file edit date.

While reviewing permissions, I discovered the files do indeed exist. Further, the files get updated upon editing and saving the template within EE admin panel. If I check the box to force a sync, the reloaded Synchronize Templates page still shows the error.

The templates seem to work fine aside from the no file exists error.

1 Answer 1

0

Upon tracing the error in EE 2.7.2, I found it to be caused by LL. 4265–4267 in system/expressionengine/controllers/cp/design.php:

if (strlen($template) > 50)
{
    continue;
}

If the template name is longer than 50 characters (including an extension like ".html"), the next line does not set $file_date:

$file_date = get_file_info($basepath.'/'.$group.'/'.$template);

This leads to the error being generated in system/expressionengine/views/design/sync_confirm.php:

$file_edit = ($template['file_exists'] === FALSE) ? lang('no_file_exists') : $template['file_edit'];

I am not sure why the 50 character arbitrary limit exists in design.php, but it seems to me that limit should be enforced at the points a user sets the template name in the first place. I filed a bug report on this issue, so perhaps EllisLab will enlighten me on the purpose of this code.

Further, I don't see anything in the documentation regarding template name length. All it says is:

Template Name

Template names may only contain alpha-numberic characters and no spaces. Since template names are typically used as part of a URL they must follow the standard URL naming rules.

So for now, the solution is to limit template names to less than 50 characters. Longer names seem to cause no issues aside from the error on the sync screen, but I haven't traced all the code to verify errors don't occur elsewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.