Jump to content

Search the Community

Showing results for tags 'comparing'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello everyone, i guess my php knowledge is not good enough to find a solution for the following problem: I'm building a website where i have projects. Each project has tags like "webdesign, responsive, cms, print, flyer" etc. At the end of a project i want to recommend other projects, which have similar tags. I want to limit the recommendations to three other projects sorted by the hightest amount of same tags. This is how far i got: I'm using <?php $interessantes = $pages->find("tags=$page->tags, id!=$page->id"); ?> to find other projects with the same tags, excluding the page i'm already on. Then i'm using three foreach-functions to go through the projects i found, the tags they have and compare them with the tags of the project i'm looking at. If i have two identical tags, i count up a variable. <?php // Projects i have found foreach($interessantes as $interessant): $i = 0; // Tags of the projects i have found foreach($interessant->tags as $tag): // Tags of the project i'm looking at foreach($page->tags as $tagreferenz): if($tag == $tagreferenz): $i++; endif; endforeach; endforeach; endforeach; ?> You can see what it looks like in the screenshot with a bit of HTML. I marked the tags of the current project green and the identical tags of other projects red with the amount of hits below. So in this example i would want to have three projects with three similar tags and get rid of those with only two and one. I guess i have to put my pages into an array (with the number of hits?), sort them and echo them with "limit=3"? Unfortunately i have no idea how to do this. You probably have an even better/shorter solution. Links to other topics are welcome to and i'll try to get my head around it. If you need further explanation, i'll try my best. Best regards
×
×
  • Create New...