【发布时间】:2013-07-23 14:52:59
【问题描述】:
NopCommerce 模板通常只包含视图和资产,而不是代码。 但他们可以吗?
我想要一个自定义的 HtmlHelper,我从我的观点中引用它。例如,如果我在我的主题中创建这个扩展:
namespace Nop.Theme.Foo.Helpers
{
public static class NopHelpers
{
public static string Test(this HtmlHelper html)
{
return "foo";
}
}
}
我将构建的 dll 放在哪里?在我看来,我该如何引用它?以下不工作:
@using Nop.Theme.Foo.Helpers;
...
@Html.Test()
错误是:error: CS0234: The type or namespace name 'Theme' does not exist in the namespace 'Nop' (are you missing an assembly reference?)。
所以我想我的问题是:
- 如何将自定义助手添加到我的主题/模板中?
- 构建输出到哪里去(以便 NopCommerce 可以加载它)?
- 如何在我的视图中引用助手?
【问题讨论】:
标签: asp.net-mvc-3 templates nopcommerce