2

我可以在我的自定义区域中的自定义控制器中访问@Umbraco.getDictionaryItem Helper,然后将其添加到我通过纯 jquery Ajax 呈现的自定义部分页面的模型中。如果我可以在我的 Surface Controller 插件中访问它,那就太好了。

谢谢,

雪儿

4

2 回答 2

0

您应该能够在服务器端文件中访问它,是的。您只需要确保在您的项目中引用了正确的 Umbraco DLL(虽然我不能 100% 确定该方法驻留在哪个 DLL 中,但您必须在源代码中查找)。

于 2012-05-09T10:17:50.637 回答
0

将您的自定义控制器创建为 Surface Controller,并获取 IRoutableRequestContext,

public class propertydetailsController : SurfaceController
{
    private IRoutableRequestContext _routableRequestContext;
}

然后访问 Umbraco.Cms.Web.Dictionary 中的 Dictionary 助手类,示例代码如下。

DictionaryHelper dictionaryHelper = new DictionaryHelper(_routableRequestContext.Application);
string valueDictionary = dictionaryHelper.GetDictionaryItemValueForLanguage("DictionaryName", "en-GB");

干杯

于 2012-05-30T07:40:22.123 回答