Selected Item Transformation not working

Tracey Penberthy asked on April 20, 2017 18:35

Hi

I have a repeater with a selected item transformation. It lists content only pages of a certain page type.

In my Transformation I have a link to the item with GetDocumentUrl().

When I click this link the selected item transformation is not displayed the url is directly to the document causing a 404 because it is a content only document.

Do I have to use something else to link and display the selected item transformation?

I cannot find any examples of how the selected item transformation is supposed to work could anyone give me some pointers?

Many Thanks Tracey

Recent Answers


Rui Wang answered on April 20, 2017 18:39 (last edited on April 20, 2017 18:39)

Is this selected item using the same template as the page you have the repeater on?

For example: News landing page has the repeater, all the child pages (individual news article page) inherits template from the News landing page.

Or if you go to that page type definition, did you assign that template as the default display for that page type?

0 votesVote for this answer Mark as a Correct answer

Tracey Penberthy answered on April 20, 2017 18:44

Hi Rui

No the news items pages are content only pages and so don't have a template

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 20, 2017 18:47 (last edited on April 20, 2017 18:50)

Tracey, the "Content Only" pages is for MVC development, it won't work for Portal Template. link text

Content only page types are suitable for pages on MVC sites whose only task is to hold content, such as individual news articles. Unlike standard page types, they don't have a representation on the website.

You will have to define a regular page type for this case.

0 votesVote for this answer Mark as a Correct answer

Tracey Penberthy answered on April 21, 2017 10:02

Thanks Rui

But the issue isn't that I want to go to the actual page to view it. I want to display the page details via the SelectedItemTransformation which surely you could do for a content only page as it is just a transformation...

I am sure this is a simple thing to do I just need an example of how to use the repeater with a SelectedItemTransformation.

Thanks again

Tracey

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 21, 2017 16:34

The way the SelectedItemTransformation works is to bring single page up with it's own URL.

For example, the repeater is on the News page listing news, the URL is abc.com/news and it's using the Default transformation (listing view). When you select a news "hello world", the URL for that is likely abc.com/news/hello-world, and that's when the SelectedItemTransformation will kick in.

0 votesVote for this answer Mark as a Correct answer

Tracey Penberthy answered on April 21, 2017 16:53

Ok thanks for clarifying that Rui, I appreciate it.

I guess the reason I was trying to do it with content only page types was I didn't want to have to create a new template to house my individual news items.

If anyone has any suggestions of how to get around this I would really appreciate it.

I did try and create a custom web part to display the news item which a user could select the transformation for but I couldn't get the custom field data to display.

https://devnet.kentico.com/questions/transformations-for-a-custom-web-part

Cheers again Rui

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 21, 2017 17:00

Tracey, the template with the repeater assign to the e.g. News page will be the only template you need to display both the listing view and all of the individual news pages. You DO NOT need to create separate template for each news item.

That's the dynamic part of CMS. It similar to the concept of abc.com/news.aspx can be the template for you to display individual news by passing the IDs, e.g. abc.com/news.aspx?id=XXX

0 votesVote for this answer Mark as a Correct answer

Oakwood Admin answered on April 21, 2017 17:05

Hi Rui

I know I just didn't want to create that one template ;)

We have a complex template structure with various editor areas in and to create the news template I would need to duplicate the functionality of the standard page template which I was hoping to avoid.

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 21, 2017 17:07 (last edited on April 21, 2017 17:10)

I think you are over complicating things in the other post you have. Let's use news as an example.

You create a News landing page with the repeater (both listing and single view transformation assigned), and create individual news under that. That "News Template" will be used to display individual news with URL like abc.com/news/hello-world.

Now, on your home page, you want to display only the latest 3 news with a different transformation (only the URL and title). Then you use a another repeater there point to the news section as the path, and select the different list view transformation for URL and title only (no need to select anything for selected item). The URL for "Hello World" will still be abc.com/news/hello-world, when you click on that it will be displayed by the "News template" with the selected item transformation.

Is that what you are looking at? In order for that to work, you need a regular page type, not a content only page type.

You may want to schedule a call with our consulting team to do a GoToMeeting to explain this. It will be much faster than all these discussions without visual.

1 votesVote for this answer Mark as a Correct answer

Oakwood Admin answered on April 21, 2017 17:10

Hi Rui

Yes thanks I have got it working with the way you have suggested.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.