What controls the incrementing of view_count_one, view_count_two, view_count_three, view_count_four? 
Posted: 14 July 2008 01:39 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

Is there a switch in EE that controls if these columns are incremented or not?

I’m looking at the exp_weblog_titles table, and these columns are all 0 for items I KNOW have been viewed.  I’m starting to wonder if we’ve implemented a system where we aren’t using the proper URL to trigger a “view”.

For instance...this URL shows all of the blog posts:
http://www.covlife.org/blog/

I wouldn’t expect a view count to be incremented.  BUT if you click a particular post, like this one:
http://www.covlife.org/blog/welcome

I would expect that entry to have its count increased by one.  But it is not.

The way we bring up a particular section entry is using this template code:
[template filename=blog]
{exp:weblog:entries weblog="BLOG_NAME" orderby="date" sort="desc"}
...
{/exp:weblog:entries}

we are relying on the “welcome” in the URL to match the url_title field—the whole dynamic="on" thing which is on by default.  This is working great for us...this individual post comes up, but it is definitely NOT triggering the view counts to increase.

Is there a “right” way to have a URL to an invidiaul section entry?

Any help would be greatly appreciated.

Thanks.

-Aaron

Profile
 
 
Posted: 14 July 2008 01:43 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31280
Joined  05-14-2004

You’re missing the track_views parameter… that is what controls if a single entry page records a hit.

 Signature 
Profile
MSG
 
 
Posted: 14 July 2008 01:54 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

WOW...how did I miss that one?  smile

Quick question: is there anyway in the main control panel to view the # of view counts?

I see it shows the # of comments...it would be cool to show the # of views when you Edit | search for a particular section.

-Aaron

Profile
 
 
Posted: 14 July 2008 02:06 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31280
Joined  05-14-2004

Not currently, unless you want to custom code an extension.

What I personally do?  I show it on all my pages, but restricted to only me seeing it (using my member_id, or the superadmin group).

Just an option. =)

 Signature 
Profile
MSG
 
 
Posted: 14 July 2008 02:10 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

I very much would like to build a custom code extension, but we’re talking about changing the “Edit Section entries” table results--that’s seems pretty low level/core EE code.

Can I do that as an official extension?  Or do I just hack up some core PHP code?

-Aaron

Profile
 
 
Posted: 14 July 2008 02:14 PM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  13102
Joined  05-15-2004

Aaron, this is precisely the reason for extensions in the first place, so you don’t have to hack PHP code. You might want to look into the edit_entries_* hooks.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 14 July 2008 02:22 PM   [ Ignore ]   [ # 6 ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

That is WAY cool!  All I need to do is tap into ‘edit_entries_modify_tableheader’--add a new column header “Hits” ... and then tap into ‘edit_entries_modify_tablerow’--add the column data...I may have to write code to query out the values in the columns:  view_count_one, view_count_two, view_count_three, view_count_four

But all in all, this should work great!  I am surprised and amazed at EE every day I use it!

So...how do I actually use these two hooks?  I see it mentions the file: cp.publish.php

Do I edit that file directly?

-Aaron

Profile
 
 
Posted: 14 July 2008 02:24 PM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31280
Joined  05-14-2004

Hi, Aaron,

No, as Ingmar said, hooks exist to avoid you hacking.  You can look at the code there to see how it works; but I’d also recommend looking at an existing, first-party extension to see how extensions work and tap into the hooks.  The development documentation should also help. =)

 Signature 
Profile
MSG
 
 
Posted: 14 July 2008 02:33 PM   [ Ignore ]   [ # 8 ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

Ok, so where do I turn on these extension hooks and edit them if I’m not touching the cp.publish.php file?

I checked in Admin | Utilities | Extension Manager.....I see “No Extensions Exist”.  It looks like Extensions are at least enabled.

Do I have to install the “Hooks” extension and then manage it from Extension Manager?

I feel like I’m missing something.

-Aaron

Profile
 
 
Posted: 14 July 2008 02:36 PM   [ Ignore ]   [ # 9 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31280
Joined  05-14-2004

The extension hooks exist already and are there for you to tap into. The Extension Manager is for managing existing extensions (that make use of those hooks, of course)

 Signature 
Profile
MSG
 
 
Posted: 14 July 2008 02:39 PM   [ Ignore ]   [ # 10 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  13102
Joined  05-15-2004

No, you have to write the whole extension yourself, as it were. This extension would “take over” from EE at some point, process the data itself and hand it back to EE, overriding some of the core code with your own. You’ll really have to read up on extension development if you want to use it effectively, though.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 14 July 2008 02:40 PM   [ Ignore ]   [ # 11 ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

Ok, how do I tap into one?

This page:
http://expressionengine.com/developers/extension_hooks/edit_entries_modify_tableheader/

says:
Hook File Location: cp.publish.php

So to tap into it...do I open the cp.publish.php file, look for the ‘edit_entries_modify_tablerow’ section and edit it?

-Aaron

Profile
 
 
Posted: 14 July 2008 02:42 PM   [ Ignore ]   [ # 12 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  13102
Joined  05-15-2004

No, you don’t. Please follow the link I provided and read up on the issue. Also, Lisa gave you very good advice there, take an existing extension and see how it does what it does. Thanks.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 14 July 2008 02:44 PM   [ Ignore ]   [ # 13 ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

I think I understand now...I have to author an extension--the list of hooks are my entry points, but I have to write an extension that will tap into those existing hooks.

I was reading it as “existing hooks” == there exists a place where I can write custom PHP code that would be called upon and interpretted if something was set (and I couldn’t figure out where to set it).

But really these hooks are the starting points for extensions to be built.

I got it now [if that is all correct] smile

-Aaron

Profile
 
 
Posted: 14 July 2008 03:32 PM   [ Ignore ]   [ # 14 ]  
Grad Student
Rank
Total Posts:  52
Joined  10-03-2007

SWEET!  I just wrote my first extension, and it works GREAT!

In the search results table on the “Edit Section Entries” page...there is now a “Hits” column and it shows the # of hits that entry has received.

Of course there are 4 different columns, but I’m only querying the first.  (I suppose you could query all of them and then display any non-zero values like “4 / 12 / 9")

Anyway, thanks for your help once again.  I guess I’ll post this “Entry Hits” extension up on the Add-On Library page.

-Aaron

Profile
 
 
Posted: 14 July 2008 04:44 PM   [ Ignore ]   [ # 15 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31280
Joined  05-14-2004

Great, Aaron!  You might also post it in the wiki Extensions page. =)

 Signature 
Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 61049 Total Logged-in Users: 15
Total Topics: 73853 Total Anonymous Users: 6
Total Replies: 398371 Total Guests: 441
Total Posts: 472224    
Members ( View Memberlist )