Jump to content

Recommended Posts

Posted

Hi all,

I'm building a "news" type site and creating a "related articles" list on article pages.  That's easy enough with tags/categories fields I've setup but I'd like to exclude any articles from the list that have already been viewed by the user that session.

I can of course store the page IDs that have been viewed in a session array.

Is there a way to do this with the PW API eg $pages->find("template=articles, category=localnews, pageid!=34,56,87") or similar?

I know I can pull all pages then exclude in PHP afterwards but would rather do without the extra overhead if possible.

Thanks

Loges

Posted

Shortest topic in history.  I keep assuming things will be more complicated than they are in PW,

The below works if anyone else is looking for the answer.

$pages->find("template=articles, category=localnews, id!=34|56|87") 

  • Like 1
Posted

I believe those IDs are collected in a visited array in $session and he will pull it from there with implode("|", $visitedCollection). :)

  • Like 2
  • 3 weeks later...
Posted

Yes Horst is right, those IDs are collected in a session array, added to as articles are viewed, using implode to convert to string.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...