1 of 2
1
Module: Recently Viewed Entries
Posted: 09 March 2010 09:19 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  738
Joined  10-14-2005

This is something we’ve had kicking about at Nine Four for a while and I’ve not yet got around to putting it up on GitHub so thought I’d drop a copy here for a couple of people that have shown interest. It basically keeps a record of a visitors recently viewed entries using their session ID.

Implementation is pretty basic, include the following on any page where you want to track entries to the recently viewed list:

{exp:recently_viewed:add_entry weblog="weblog_short_name" entry_id="{entry_id}"

You could also pull the entry_id from a segment in the URL to negate the need to place this in between the weblog:entries tag. Then use the following to spit out details of the entries they have recently viewed:

{exp:weblog:entries weblog="weblog_short_name" parse="inward" fixed_order="{exp:recently_viewed:get_entries weblog='properties' distinct='off'}"}{title}{/exp:weblog:entries} 

Download here: http://ninefour.co.uk/labs/recently-viewed/

That’s it! Enjoy! smile

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 09 March 2010 09:24 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  229
Joined  08-14-2007

Taking it for a spin now Nathan - many, many thanks for being so responsive!

UPDATE: I’m very pleased to report that this works a treat and is EXACTLY what I was after! If you don’t ask, you don’t get grin

Many thanks Nathan. I definitely owe you one.

 Signature 

Jim Pannell | Six Media Web Development | Copenhagen, Denmark
Twitter: @jimpannell

Profile
 
 
Posted: 09 March 2010 09:27 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  738
Joined  10-14-2005

No worries, let me know of any issues or ideas for improvements. smile

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 10 March 2010 11:33 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
RankRank
Total Posts:  197
Joined  06-06-2007

Great. Have a project coming up to try this on. Thanks!

Profile
 
 
Posted: 10 March 2010 08:33 PM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRank
Total Posts:  3218
Joined  05-13-2004

Will likely use this on my current project.

 Signature 

Recent version: EE 2.4.0 | 2.x Bug Tracker | How to Post a Support Request | Version Upgrade | 2.4.0 Change Log

on twitter @CS_sean

Profile
 
 
Posted: 11 March 2010 01:08 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  257
Joined  01-22-2007

Uploaded the files, went to the Modules tab and got…

Error

Unable to load the following language file:

/lang.recentlyviewed.php

 Signature 

euanross.com    @euanross

Profile
 
 
Posted: 12 March 2010 05:34 AM   [ Ignore ]   [ # 6 ]  
Grad Student
Rank
Total Posts:  71
Joined  01-07-2008

@Euan Make sure you upload the language file to the language directory in system.

I can’t seem to get this to work - I have this in my view template near the top

{exp:recentlyviewed:add_entry weblog="adventure" entry_id="{entry_id}"

and this in my sidebar

{exp:weblog:entries weblog="adventure" parse="inward" fixed_order="{exp:recentlyviewed:get_entries weblog='adventure' distinct='off'}"}{title}{/exp:weblog:entries} 

But it’s not returning anything - any ideas?

Profile
 
 
Posted: 21 March 2010 03:35 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  738
Joined  10-14-2005

Could you post the complete template content perhaps? It may be that the exp:recentlyviewed:add_entry tag is not within a weblog:entries tag pair…

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 21 March 2010 07:02 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  402
Joined  11-22-2006

I was having problems showing recently viewed results until I remembered that I needed to include extra bits into the weblog parameters, so in my case it looks like:

{exp:weblog:entries weblog="courses" status="open|adult" show_future_entries="yes" parse="inward" fixed_order="{exp:recentlyviewed:get_entries weblog='courses' distinct='off'}"}
{title}
{
/exp:weblog:entries} 
 Signature 

pfweb.co.uk

Profile
 
 
Posted: 21 March 2010 07:26 AM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  724
Joined  11-11-2006

Any chance of an EE2 version?

All the best
Lee

Profile
 
 
Posted: 21 March 2010 08:04 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  738
Joined  10-14-2005

Possibly, I’ve not tried migrating any of our add ons yet but this would be a nice simple one to start with. smile

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 21 March 2010 08:06 AM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  724
Joined  11-11-2006

Many thanks for getting back to me, I’ll watch out for it just in case it happens on day.

Profile
 
 
Posted: 24 March 2010 05:25 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  402
Joined  11-22-2006

Is there some means of limiting how long the session data is stored?
I looked at the database to see what was stored and there were a lot of records. So I’m concerned that the volume of data could get enormous.

I am trying it on an outdoor activity booking site where it shows visitors which individual activities they have viewed so far.

 Signature 

pfweb.co.uk

Profile
 
 
Posted: 26 March 2010 05:12 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  738
Joined  10-14-2005

Hi Paul, not at present no but it’s certainly something we need to add! I’ll post back here as soon as it’s done!

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 29 March 2010 07:12 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  738
Joined  10-14-2005

Hi all, I’ve made some adjustments to this module over the weekend to prevent against data bloat! You can grab the revised version here (http://ninefour.co.uk/labs/recently-viewed/). I’ve adjusted the module file names so you’ll have to uninstall the previous version and then install this new version for the changes to take effect. The tags have also been adjusted slightly to reflect this and the docs have been updated to take account of this. smile

Basically the module now limits the number of entry views that it tracks for any given user to 5 by default, however you can tweak this setting in the mod.recently_viewed.php file yourself to any figure. This will be added as a control panel setting in a future release.

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 06 April 2010 12:29 PM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  10
Joined  09-07-2009

Thanks for the great plugin and the much-needed limit addition in 1.1 ... I was about to do that myself!

Profile
 
 
Posted: 06 April 2010 08:39 PM   [ Ignore ]   [ # 16 ]  
Moderator
Avatar
RankRankRankRankRank
Total Posts:  3218
Joined  05-13-2004

Nathan,

I just downloaded and installed this but it isn’t putting out any results for me. The code I added is copied from your docs.

{exp:weblog:entries weblog="articles" parse="inward" fixed_order="{exp:recently_viewed:get_entries weblog='articles' distinct='off'}" dynamic="off"}
{title}
{
/exp:weblog:entries} 

If I remove the recently_viewed tag it does spit out entry titles. Could there be a conflict with Structure which is running this particular weblog?

 Signature 

Recent version: EE 2.4.0 | 2.x Bug Tracker | How to Post a Support Request | Version Upgrade | 2.4.0 Change Log

on twitter @CS_sean

Profile
 
 
Posted: 07 April 2010 04:15 AM   [ Ignore ]   [ # 17 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  738
Joined  10-14-2005

Hi Sean, could you post a more complete extract of your page template for me to look at? smile

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 08 April 2010 12:57 AM   [ Ignore ]   [ # 18 ]  
Moderator
Avatar
RankRankRankRankRank
Total Posts:  3218
Joined  05-13-2004

Nathan, that is pretty much the whole template - it’s sitting in the sidebar surrounded by a div with a border on it so I know where it should display.

 Signature 

Recent version: EE 2.4.0 | 2.x Bug Tracker | How to Post a Support Request | Version Upgrade | 2.4.0 Change Log

on twitter @CS_sean

Profile
 
 
   
1 of 2
1