How to get ListContent from Content item

May 11, 2016 at 1:55 PM
Edited May 11, 2016 at 1:56 PM
1.
I create "myDetailItem" and "myMasterItem" content type.

2.
I create view "myListViewWithHeaderData" and setup as:
Type for Content == myDetailItem
Enable List == true
Type for List == myMasterItem

3.
Now I can add this view to different locations on portal and edit
header data (myMasterItem) and I can also add/delete/.. items (myDetailItem)

4
Then I create another view without content type, and set DataPipeline to custom query.
Now i can get list of all myDetailItems.
  1. now start the problem.
    How can I get "ListContent" object (myMasterItem) for each item from query returning all myDetailItems
Is this posible, or I "design" my logic tottaly wrong?
Coordinator
May 11, 2016 at 2:37 PM
I think you're on the wrong track - with the master/detail concept.

Whenever you create a list and details view, then the content-item shown on both is the SAME item - it's just that you're showing less of it in the list view. If this feels very new to you, I recommend you check out the blog app which is probably a bit like what you're looking for, or the
or the employee directory, which may even be more what you want http://2sxc.org/en/Apps/Details?AppGuid=ce646ddd-8789-4fef-8f39-b7e1d1908fe3
May 11, 2016 at 2:50 PM
Thanks for guidelines i already check this samples and can't find solution for:


I want to make "news" app and in the "header" define category and then add small "news items" and put this app on multiple sub pages,
with different categories.

Then I want another view display only in one location of web site and list "news item" and in the same row display category text
from news header.

Can you give mi some directions how to achive this?
May 11, 2016 at 2:58 PM
I know if I make one entry point for all new news items then I know how to make another views and display only new items for that category.

But user want to enter news on the location where the news must be so hi don't nead to select category and category came directly from location wher the news is entered.

I know this is a little strange case, but I try to learn 2sxc and I am iterested if this is posible.

Also that way I culd put more default values for items with this "header data",
and i later I change this parameters all related items will have also this data changed.
Coordinator
May 11, 2016 at 3:39 PM
You can do all this fairly easily. Let's just be sure I know what you're trying

You have a news-app.

You have a view where the editor manually adds news-items. these item show up there (and only these).

You have another view which should show all news item of a specific category, and you would like to configure that category per instance - so your header-item would contain a field "category" and this should be used to then filter from all items in the app. right?
May 11, 2016 at 4:00 PM
First part is OK.

The second view must show "news-items" from all categories (all news apps on diferent locations)
But on list of all "news-items" i also wan't to have link or text that can link me back to original location/category app.

So the second part you write is wrong. I wan't to define category in first view "heder/presentation/..."
and when I list all news this "header/presentation/.." shuld be availible in this new view for all news items.

Sorry for bad english I am not native english speaker.
Coordinator
May 11, 2016 at 6:33 PM
Ok - let's try again
  1. News app
  2. each item has a category (like product1, product2, company, etc.)
  3. The details-page is always in the same place - like /news/item/launch-of-product-xyz
  4. you have the main news list page which shows a list of everything - like /news
  5. you have extract in other pages, showing only certain news, like on /products/product1 you also want to show all news items of that product
ok?
May 11, 2016 at 7:00 PM
Realy thanks for help, but i think that I must draw some diagram it will be easyer, because my limited language skils...
I understand reading well but I am realy bad for writing :-)

I will make better "requirements" and posted again.
May 11, 2016 at 8:14 PM
Coordinator
May 12, 2016 at 3:02 PM
If your main question is "can I find a list of all news items and somehow know on what page they were created" then the answer is yes :)

Here's the trick
  1. you need to know the page on which the news-item is "hosted" - either because it's a field in the category (if all category1 are on page 395 etc.) or a field in the news item.
  2. The field should be a hyperlink field, at should have page-picker enabled - for this example, we'll assume it's called "Page" and it's on the category, which is on the news-item
  3. if the field is in the category, then you will prefill it, and access it later on with NewsItem.Category[0].Page or something
If you want this to be per-news-item, then still create the "Page" field, but add a prefill for "page:@Dnn.Tab.TabID" You're all set :)