Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Embeded content
umend
#1 Posted : Tuesday, March 22, 2011 2:15:35 PM(UTC)
Rank: Member
Groups: Registered

Joined: 3/14/2011(UTC)
Posts: 23
Location: Kiev
I see embeded conent type is a new feauture in 3.0
http://kooboo.com/Docume...3/Embedded-content-type

It seems to be very useful, but, I did not found any example how to use it in View
jifeng
#2 Posted : Tuesday, March 22, 2011 2:48:58 PM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,555
Location: Xiamen China
It just renamed, it comes from child content, like: article/comment relation. You can get the embedded contents through API. For example:

Code:


var children = parentContent.Children();

var parent = childContent.Parent();

Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
umend
#3 Posted : Tuesday, March 22, 2011 3:22:47 PM(UTC)
Rank: Member
Groups: Registered

Joined: 3/14/2011(UTC)
Posts: 23
Location: Kiev
For example, I have 2 embeded folders for article: comments & tags (or images).

How can I get comments?

if I'll type ViewData.Article.Children() ill got all (comments & tags)?

Please give me some example, how to use parentContent.Children();

Also, is any easy way to get all comments for all articles?

Is there any info about API, except source code?
jifeng
#4 Posted : Tuesday, March 22, 2011 3:39:41 PM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,555
Location: Xiamen China
The document will be coming soon.

Yes, that code almost can get all the comments for the article, but the correct C# code will be:

Code:

var children = ((Kooboo.CMS.Content.Model.TextContent)ViewBag.Article).Children(commentSchema);

// Then you can also continuing add some filters on children queryable. For example:

children = children.WhereEquals("Published",true);

// If you are familiar with C#, you will find it is similar to LINQ.

// It is also easy to get all comments for all articles. There are two ways:

1. var allComments = commentSchema.CreateQuery();

2. var allArticleComments = articleFolder.CreateQuery().Children(commentSchema);

// As you see, get all comments for all articles, you just only remove that all filters.
Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
umend
#5 Posted : Tuesday, March 22, 2011 3:50:00 PM(UTC)
Rank: Member
Groups: Registered

Joined: 3/14/2011(UTC)
Posts: 23
Location: Kiev
Thanks, great example.

I just did not get one thing: "commentSchema" - what is it?
jifeng
#6 Posted : Tuesday, March 22, 2011 4:04:12 PM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,555
Location: Xiamen China
The schema is the content type you see in UI. We call it "schema" in previous version and remain the name in this version. You can create a schema object through this code:

Code:


var commentSchema = new Schema(Repository.Current,"Comment");

Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
umend
#8 Posted : Tuesday, March 22, 2011 4:34:21 PM(UTC)
Rank: Member
Groups: Registered

Joined: 3/14/2011(UTC)
Posts: 23
Location: Kiev
Thanks.

What if I want embeded content to have a Category?

For example, comments will have a type (internal, external, private etc.)
jifeng
#9 Posted : Wednesday, March 23, 2011 2:16:39 AM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,555
Location: Xiamen China
Yes, it is a restriction. The category relation is on folder to folder. The embedded content set up on content type. So it is impossible to have a category on embedded.
Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
Baseless
#7 Posted : Thursday, August 11, 2011 7:20:36 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
EDIT: Nvm, problem solved
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.765 seconds.