Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Displaying list using keyword View modes: 
User avatar
Member
Member
Jon White - 8/21/2013 8:19:32 AM
   
Displaying list using keyword
Hi there,

We are a scientific organisation where many of our staff members contribute to hundreds of publications.

The aim is to have a list/database of all the publications and then each staff member will then have a biography page where i want to 'pull' in the recent publications that they have contributed to.

This would be great to do; something where it would use the person's name i.e. 'jon smith' and then it show all the publications they worked on.

I know of 'related docs' but i want it to automatically do it, so when we upload a new publication to the main publications page - it then shows on the staff member's page who worked on it - using their name.

I hope that makes sense, is this possible?

Thanks

Jon

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 8/24/2013 3:31:30 AM
   
RE:Displaying list using keyword
Hi,

Thank you for your message.

This is absolutely posible.

Lets say you have document types such as "Publications" and "Autors". Whenever you would insert a new Publication there would be field which would get the name of autors from Autors document type and you would have to select some autor before the publication could be inserted.

So every publication would have an autor name - now on any page you would like to show all publication of some users you could simply use a repeater and in where condition of the repeater you would set a condition such as "where AutorName = somename"

I hope its understandable. Feel free to ask if you have any other questions.

Kind regards,
Richard Sustek

User avatar
Member
Member
Jon White - 8/28/2013 11:41:26 AM
   
RE:Displaying list using keyword
Hi there, thank you for your reply.

I have a publications document type with a 'MainAuthor' Column field.

I guess i'd have to set up a repeater on each staff profile page to display all publications that that specific member of staff has contributed to (as a main author).

So i would add a repeater on each staff page and then add a WHERE condition as:
where MainAuthor = J.Bloggs

And that will filter only his publications through?

I don't fully understand the WHERE command, are you able to tell me what exactly i put in the box, i tried the above and it didn't work - have i got to add any <%> ?

Sorry i'm new to Kentico

Jon

User avatar
Member
Member
kentico_sandroj - 9/2/2013 2:16:50 PM
   
RE:Displaying list using keyword
Hello,

Thank you for the additional clarification. Could you also confirm which development model you are using?

You would not have to create a separate page for each staff memeber. You can create one page with a repeater and a WHERE condition that uses the current user context macro.

The where condition in the repeater would be {%CurrentUser.UserName%} which would render as the user which is currently logged in. If the MainAuthor value matches the username of the current user, the repeater will only load records that were created by that user. If the format is not the same, you could develop a custom macro which returns the username in the appropriate format.

Another option could be using the Wildcard URLs.

Please let me know if you have any additional questions.

Best Regards,
Sandro Jankovic

User avatar
Member
Member
Jon White - 9/3/2013 6:21:55 AM
   
RE:Displaying list using keyword
Hi Sandro,

I'm using portal development.

I must admit i'm not a heavy 'coder' as such (some of the more in depth stuff I leave to a couple others here).

However I'd like to make this work myself.

I don't understand how 'current user' would work? This is a public facing website where there would be no user context.

Each staff member needs a public facing profile so I have to create a separate page (document type) for their picture, info, specialty, biography etc... Then their publications would be automatically loaded below based on their name (using a repeater)

I just don't know how I could make this happen. so basically search the publications for their name and 'pull' them in a list of just their publications into their bio page.

Sorry if I'm being stupid here, I'm sure there's a simple answer



User avatar
Member
Member
kentico_sandroj - 9/3/2013 11:54:29 AM
   
RE:Displaying list using keyword
Hello,

Thank you for the additional clarification. Now that I have a better understanding of your requirements, I would suggest using the Wildcard approach instead. If you install the Intranet Portal example and navigate to the Employees page, you can see how the Wildcard URLs can be used. Each Employee links to a Profile page where their specific information is listed. You could use the same approach for displaying the documents for each author. Would this approach work for you? Please let me know if you have any questions.

Best Regards,
Sandro Jankovic

User avatar
Member
Member
Jon White - 9/5/2013 9:28:03 AM
   
RE:Displaying list using keyword
I think Richard's answer is more along the lines of what i'm looking for, i'll explain my scenario:

So lets say 'Joe Bloggs' has been main author on 10 publications, they will all be added one -by -one using a publications document type, until we have a long list of publications, these will then be linked to a main page where all publications will be displayed (which is needed on the site).

His name will be in the 'mainauthor' field for those 10, but there will be others added where he is not.

So, now I want to make 'Joe Bloggs' an individual staff profile page, which, underneath lists only his publications where he was 'mainauthor'.

I can get the whole list of all publications through using a repeater on their profile page but how would I make the repeater only display hispublications (as main author) and not all of them?

I assume it is a macro in the where condition.

I basically need to tell it to:

display the list of all publications ( from a separate page/document type), but filter/only display the ones which match the name of the staff member who's biography page it is or:

Where 'current biography document type name' matches 'mainauthor' in publications list.

Something like that. Sorry again for the hassle but i need to find a way to do this, otherwise the publications will have to be entered again on each staff member page!

Thank you

Jon

User avatar
Member
Member
kentico_sandroj - 9/5/2013 5:17:53 PM
   
RE:Displaying list using keyword
Hello,

Thank you for the additional clarification.

My previous suggestion was mainly regarding the Profile pages; by using Wildcards, you can avoid creating a separate page for each Author. Otherwise Richard and I were discussing the same approach, which is using the macro in the WHERE condition.

However, if you are creating static pages for author, the approach would be much easier. Lets assume that you have a Profile page for author John Smith that contains a repeater which loads publications from all authors. In order to load only specific publications, you can specify this in the WHERE condition:

DocAuthor = 'J.Smith'

If you have a separate profile page for each author, it should be fine to hard-code the WHERE condition since that would not change. Otherwise, you would have to develop a custom macro or use querystrings and a querystring macro to specify the where condition. I can walk you through the setup process for this, however, it sounds like you are after the static-page approach which should be much simpler, unless I am misunderstanding the requirement. It's not a hassle at all so please feel free to ask as many questions as it is necessary to configure this.

User avatar
Member
Member
Jon White - 9/6/2013 11:50:35 AM
   
RE:Displaying list using keyword
Ahh it IS working to filter the publications which is great! however, all the staff profile pages use the same template, so when I add this repeater with the 'where condition' for a name e.g. john smith, it shows on every persons' page all of 'john smith's' publication's for instance.

Obviously an ad hoc template would work, but that would not be ideal and a pain to implement. I assume this is what you meant by 'static' page'?

I need to have this repeater on my template that can be programmed individually for each separate name. Can I make the repeater web part exclusive to each 'staff' document type, or do I need to automate some code such as : 'staff name' match with: 'MainAuthor' and display, without dealing in specific names (in other words; fetch the publications based on the staff name automatically). Or have a missed a setting that will not show the same repeater setting on each page?

I hope that makes sense

Thank you
Jon

User avatar
Member
Member
vcarter - 9/6/2013 12:05:44 PM
   
RE:Displaying list using keyword
When I had a similar problem I approached it as a matter of hierarchy. So publications are associated with an author, correct? This IMO should be done at the time a publication is created, authors show up as a list(or dropdown) and are stored(I would go by ID not name BTW) on the publication creation form.

Then when you setup the detail page/transformation for the publication, you can simply use the Author ID passed into the associated publications repeater via macro. So you would have one template, that dynamically listed the publications based on AuthorID, no need for multiple templates.

Another option would to simply allow publications as a child document type for authors, then just put the publications as they are created under the relevant author, this would let Kentico do the filter for you as you could just use the document path to the author for the publication repeater on their page, I think the generic path for this is "./%" That gets everything below the currently selected item, allowing multiple pages(in this case author details pages) to use dynamic functionality.

I hope that makes sense.