Developer forum

Forum » Development » NewsV2 - NewsItemViews (Where is it located?)

NewsV2 - NewsItemViews (Where is it located?)


Reply
I've been trying to figure out how newsv2 handles its Show by Views but i cant seem to find it anywhere in the database?  , cause i need to manualy update the views, could anyone point me in the right direction of where it is stored?

Replies

 
Reply
Hi Jais,

Please clarify what do you mean under "Show by Views"? Statistics of the opened news?

SELECT TOP 100 Statv2ObjectElement as NewsId, COUNT(*) As Clicks FROM Statv2Object WHERE [Statv2ObjectType]='News' GROUP BY Statv2ObjectElement ORDER BY COUNT(*) DESC
 
Reply
Basicly i have a custom module which shows some news, however when i use my custom module to show the news it doesent register that a user has seen the news.

And i use the standard newsv2 to show most popular news, however this doesent work because i use my custom module to show my news normally.

Id prefer using the API to add a record to the database but i couldent locate it anywhere.

So i just need'd to know which table to add my row in so that dynamicweb knew that X had seen the news item.

http://nopaste.dk/p3195

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Jais

You need to add the following piece of code to your Custom Module, when rendering the News Item:

var stat = new Dynamicweb.Frontend.StatisticsObject("News", news.ID.ToString());
 

That will increment the statistics with the News items you render in your Custom Module. Just make sure, that the first parameter in the constructor is "News" and the second is the ID of the NewsItem being rendered.

Hope this helps :)

- Jeppe

 
Reply
 Thank you what i need'd :) , can i ask why this is not part of the newsitem object? wouldent it make more sense? :)

Edit: what is the click parameter on the newsitem object used for? 

Also the codesnippet worked so thanks for the hint :)
 
Reply
 Hi Jais,

Clicks property contains information about how many times the news has been opened. This is information stored in statistics.


 
Reply
 Could you add a set to the property ? so you dont have to add through statistics but can add on the news item itself. 
 
Nicolai Høeg Pedersen
Reply
Making a set on that property would not make sense since that property is a calculation based on statistics.

The newsitem object itself has no way to find out when it is displayed in frontend - thats why you have to log it in the rendering.

 

You must be logged in to post in the forum