Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 点扩展错误_C#_Templates_Extends_Dotliquid - Fatal编程技术网

C# 点扩展错误

C# 点扩展错误,c#,templates,extends,dotliquid,C#,Templates,Extends,Dotliquid,我有一个非常基本的模板,即: {% extends "Body.tpl" %} {% block content %} <p> <a href="{{Url}}">{{Title}}</a> </p> {% endblock %} 但当我试图解析模板时,我得到了一个错误: Liquid Error - 'extends' must be the first tag in an extending templat

我有一个非常基本的模板,即:

{% extends "Body.tpl" %}

{% block content %} 
    <p>
        <a href="{{Url}}">{{Title}}</a>
    </p>
{% endblock %}
但当我试图解析模板时,我得到了一个错误:

Liquid Error - 'extends' must be the first tag in an extending template
但据我所知,“extends”是模板中的第一个标记

非常感谢您的帮助

提前谢谢
Terry

您将传递什么到
DotLiquidTemplate.Parse
?是第一个模板的内容吗?即以
{%extends…%}
开头的模板?我想我以前见过这个错误,在
{%extends%}
标记前面有一个Unicode字节顺序标记。问题是它将Unicode BOM作为第一个字符。
    public static class DotLiquidTemplate
    {
        public static Template Parse( string Html )
        {
             Template.NamingConvention = new DotLiquid.NamingConventions.CSharpNamingConvention();
             Template.FileSystem = new LocalFileSystem( Globals.AbsolutePath + @"\Html\" );
             return Template.Parse( Html );
        }
    }
Liquid Error - 'extends' must be the first tag in an extending template