我创建了Include方法,如下面的代码。
如下所示的products.liquid
{% include product-list-item %}
如下所示的包含方法:
public class IncludeFileSystem : IFileSystem
{
public string ReadTemplateFile(Context context, string templateName)
{
string themesLocalPath = "";
var templatePath = LiquidTemplateHelper.ResolveTemplatePath(templateName, themesLocalPath);
return LiquidTemplateHelper.ReadTemplateByPath(templatePath);
}
}
但是对于不同的用户,他们从文件中加载不同的“product-list-item”。 如何设置get并设置“themesLocalPath”值?
答案 0 :(得分:0)
使用文件系统有两种方法:
Template.FileSystem
renderParameters.Registers["file_system"]
来电中设置Template.Render
。例如,这允许您为每个用户创建自定义文件系统的差异实例。