Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > News Category Filter View modes: 
User avatar
Member
Member
jinijose-gmail - 1/10/2011 5:38:24 AM
   
News Category Filter
I have using version 5.5.
In that we created one NewsType field for the News.
I need to sort the news based on the NewsType. For that we created as static link and put all the available field values there. for eg: the news are only in these categories. category1, category2,category3. We created the html links and passed the type as querystring. it is working fine.
The problem is how can we list all the news ?
If we add alink "All" it is not working.
How can I solve this ?

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/10/2011 8:27:15 AM
   
RE:News Category Filter
Hello,


I suppose you use a Where condition to list the news according the querystring parameter. How does your Where condition look like?

It will display all the news if the where condition is empty or always true...


Best regards,
Helena Grulichova

User avatar
Member
Member
jinijose-gmail - 1/10/2011 9:10:48 AM
   
RE:News Category Filter
hi
yea, i am using a where condition.
The field I created is NewsCategory.
So in my where condition i used NewsCategory='{%Category%}

where Category is the querystring parameter.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/11/2011 3:15:59 AM
   
RE:News Category Filter
Hi,


you could use the Where condition like:

'{%Category%}' = '' OR NewsCategory='{%Category%}


Best regards,
Helena Grulichova

User avatar
Member
Member
jinijose-gmail - 1/11/2011 3:40:04 AM
   
RE:News Category Filter
It is getting error.
What I mean from clicking all is , it should display all the category news.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/11/2011 3:56:30 AM
   
RE:News Category Filter
Hello,


What error message do you get?

Now it displays all the news if there is no query string parameter.

You can also use for example "all" query string parameter on link for all news and then the Where condition can look like:

'{%Category%}' = 'all' OR NewsCategory='{%Category%}


How should it behave if there is no query string parameter?


Best regards,
Helena Grulichova

User avatar
Member
Member
jinijose-gmail - 1/11/2011 4:37:14 AM
   
RE:News Category Filter

Sorry I made a mistake. I just copy paste your code. It is missing one single quote at the end. Now it is working perfectly.

Thank you

User avatar
Member
Member
jinijose-gmail - 1/11/2011 5:52:17 AM
   
RE:News Category Filter
one more doubt.
how can i archive the news. ?

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/11/2011 6:42:45 AM
   
RE:News Category Filter
Hello,


you can use the workflow so that you could archive the news. Please see the documentation: Using workflow.


Best regards,
Helena Grulichova

User avatar
Member
Member
jinijose-gmail - 1/11/2011 6:43:52 AM
   
RE:News Category Filter
Is there any other option other than workflow ?

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/11/2011 7:08:43 AM
   
RE:News Category Filter
Hi,


how should it work?

You can add a custom field (a checkbox for example) to News document type. Then you can display the news in repeater with Where condition about this field. For example the new field: Archived and the Where condition: Archived = 0.

But the document will be available on live site even hidden in the repeater.


Best regards,
Helena Grulichova

User avatar
Member
Member
jinijose-gmail - 1/11/2011 7:12:21 AM
   
RE:News Category Filter
Ok. Thank you

User avatar
Member
Member
jinijose-gmail - 1/12/2011 5:18:36 AM
   
RE:News Category Filter
Is it possible to pass a dynamic date in querystring. like below.
I need to filter the news by last 7 days news.
how can it achievable ?

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/12/2011 2:32:43 PM
   
RE:News Category Filter
Hello,


I am not sure how it should work. Do you want to display the last 7 days news?

How do you want to use the query strings there?


Best regards,
Helena Grulichova

User avatar
Member
Member
jinijose-gmail - 1/12/2011 11:00:28 PM
   
RE:News Category Filter
I dont know exactly.
but my requirement is to pass current date -7 date.
for eg: if today is Jan 13 2011 , then the querystring date value should be NewsReleaseDate > Jan 06 2011.
If this is possible then I can built the archive page same as above. but in that I have to pass NewsReleaseDate < Jan 06 2011.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/13/2011 3:27:56 AM
   
RE:News Category Filter
Hello,


You can use the standard SQL methods for current date - 7. Please see here: MSDN documentation for example.

I do not know where you need the querystring parameter in this case.


Best regards,
Helena Grulichova

User avatar
Member
Member
asharfmoidu-yahoo - 1/17/2011 3:45:04 AM
   
RE:News Display for last 7 days
Hello,

I want to make a filter in news for last 7 days

Thanks & Regards

Asharaf.T.Moidu

User avatar
Member
Member
asharfmoidu-yahoo - 1/17/2011 3:50:45 AM
   
RE:News Display for last 7 days
I have using version 5.5.
In that we created one NewsType field for the News.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/17/2011 8:15:02 AM
   
RE:News Display for last 7 days
Hello,


you can use a Where condition for this as we mentioned here. For example:

DATEDIFF(day, NewsReleaseDate, GETDATE()) <= 7


Best regards,
Helena Grulichova