多对多关系
我一直在尝试在 Orchard 中的内容项之间“制造”一个多对多关系模块。不幸的是,没有成功。但后来我知道如何用标签模拟这种关系。基本上,我必须将“项目”内容类型/部分与“成员”类型/部分相关联。这是我的想法:
创建一个“项目”内容类型,并为其附加一个标签部分。创建项目类型列表。
创建“成员”内容类型,并为其附加标签部分。创建成员类型列表。
在项目页面上添加一个容器小部件,在其中显示项目类型列表的元素,但在视图中添加一个过滤器,仅显示具有“project-xx”标签的内容项(project-x 是标记当前项目)。到目前为止我看到的唯一问题是:
如何访问页面上另一个内容部分/类型的标签,以便在视图中使用它(从“成员”视图中访问“项目”标签)?
关于此的任何想法或关于在 Orchard 1.1 中对内容项之间的多对多关系进行建模的任何其他想法,我们将不胜感激。我已阅读文档,但尚未管理在内容项之间创建 nn 关系。
I have been trying to "manufacture" a many-to-many relation module between content items in Orchard. Unfortunately, with no success. But then I got an idea of how to simulate such a relationship WITH TAGS. Basically, I have to relate a "project" content type/part with a "member" type/part. Here is my idea :
Create a "project" content type, and attach a tag part to it. Create a list of project type.
Create a "member" content type, and attach a tag part to it. Create a list of member type.
Add a container widget on the projects page, in which you show the elements of the list of project type, but in the view add a filter that only shows the content items that have a "project-xx" tag(project-x being the tag on(of) the current project). The only problem I see so far is :
How can I access the tag of another content part/type on the page, so as to use it in a view(access the "project" tags from within the "member" view ) ?
Any idea on this or any other idea on modeling a many-to-many relationship between content items in Orchard 1.1 would be appreciated. I have read the docs, but have not managed the create a n-n relationship between content items.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道这有点旧,但是你见过 Mechanics 模块吗(http: //gallery.orchardproject.net/List/Modules/Orchard.Module.Downplay.Mechanics)?
这允许您在内容项之间创建连接。但是,它不适用于最新版本的 Orchard(我认为 >= 1.5)。如果您仍在使用 1.1,值得一试
I know this is a bit old, but have you seen Mechanics module (http://gallery.orchardproject.net/List/Modules/Orchard.Module.Downplay.Mechanics)?
This allows you to create connections between content items. However, it doesn't work with more recent versions of Orchard (I think >= 1.5). Worth a try if you are still using 1.1