Orchardcms 在Orchard模块中创建新页面
如何在orchard模块中创建新页面?我在orchard中有一个页面和控制器,但是如何在route模块中添加新页面Orchardcms 在Orchard模块中创建新页面,orchardcms,orchardcms-1.6,orchardcms-1.8,orchard-modules,orchardcms-1.9,Orchardcms,Orchardcms 1.6,Orchardcms 1.8,Orchard Modules,Orchardcms 1.9,如何在orchard模块中创建新页面?我在orchard中有一个页面和控制器,但是如何在route模块中添加新页面 public IEnumerable<RouteDescriptor> GetRoutes() { return new[] { new RouteDescriptor { Priority = 5, Route = new Route(
public IEnumerable<RouteDescriptor> GetRoutes() {
return new[] {
new RouteDescriptor {
Priority = 5,
Route = new Route(
"BlogX", // this is the name of the page url
new RouteValueDictionary {
{"area", "BlogX"}, // this is the name of your module
{"controller", "Home"},
{"action", "Index"}
},
new RouteValueDictionary(),
new RouteValueDictionary {
{"area", "BlogX"} // this is the name of your module
},
new MvcRouteHandler())
}
};
}
public IEnumerable GetRoutes(){
返回新的[]{
新路由描述符{
优先级=5,
路线=新路线(
“BlogX”,//这是页面url的名称
新RouteValueDictionary{
{“area”,“BlogX”},//这是模块的名称
{“控制器”,“主”},
{“操作”,“索引”}
},
新建RouteValueDictionary(),
新RouteValueDictionary{
{“area”,“BlogX”}//这是模块的名称
},
新的MvcRouteHandler())
}
};
}
这应该很容易。将Orchard.ContentManagement.IContentManager
的实例注入控制器,然后只需调用ContentManager.New(“YourContentType”)
。还可以查看内容管理器的其他可用方法,如Publish()
,您可能还需要调用这些方法