Jump to content

Search the Community

Showing results for tags 'ratings'.

  • 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 4 results

  1. Hey Guys, I am using the https://processwire.com/api/fieldtypes/comments/ to allow users to comment and rate. Whats the best approach to get an average of all the star ratings for the page? Any direction is greatly appreciated!
  2. I am relatively new to processwire. I also started learning html and css just this year. I have basic understanding of concepts but am still at a loss on the technical language but I am excited to learn a lot more. I'm working on starting a website that is along the lines of fmylife.com. I have my design down and I understand the basics of processwire. What I can't figure out is how to create the main component of this website. I need to be able to allow any user without creating an account or even inputting an email address to post directly on the main page. Obviously without allowing them to touch anything else on the page except for their individual post. Maybe using individual IP addresses and cookies. These posts will resemble that of posting on facebook. I need to be able to have a backlog of these in order to create categories for the "best posts" etc. and the capability of deleting any content that I see fit. The furthest I've gotten is the idea of creating one continuous thread. Also, I know wordpress has the capability of a similar way but requires buying into the premium. At this point I am not set up to spend money but if there is a better way that I will have to pay for I can be open to that down the road. For now though I'm trying for the free route. I'm wondering if anyone has some great pointers or tips for making this a possibility. Thanks for the help in advance! KFlare
  3. Just though I'd post in case anyone else was interested in creating a 5 star rating system. It is very rudimentary I should point out and am sure there are thousands of better ways but it seems to get the job done OK for me. It's only using cookies to check if someone's already voted so it's not at all foolproof! If any advanced users have any pointers to improve it, that would be great! <?php include("./header_plain.inc"); ?> <div id="new_blog_view" class="row"> <div id="blog_header"> <a href="<?php echo $config->urls->root; ?>"><img src="<?php echo $config->urls->templates; ?>styles/images/ag_logo_2.png" alt="" /></a> <h4><a href="<?php echo $page->parent->url; ?>">From the Blog</a></h4> </div> <h1><?php echo $page->title; ?></h1> <h6><?php echo $page->entry_date; ?></h6> <?php if ($page->image) { ?> <img src="<?php echo $page->image->url; ?>" alt="<?php echo $page->title; ?>" id="blog_image" /> <?php } ?> <?php $class = "new_blog_view_content"; if (!$page->image) { $class .= " divide"; } ?> <div class="<?php echo $class; ?>"> <?php echo $page->body; ?> </div> <?php echo $page->comments->render(); ?> <?php echo $page->comments->renderForm(); ?> <?php if ($page->vote_count > 0) { $vote_average = round($page->vote_score / $page->vote_count, 2); if ($vote_average > 0 && $vote_average < 1) { $url = $config->urls->templates . "styles/images/stars_0.png"; } elseif ($vote_average >= 1 && $vote_average < 2) { $url = $config->urls->templates . "styles/images/stars_1.png"; } elseif ($vote_average >= 2 && $vote_average < 3) { $url = $config->urls->templates . "styles/images/stars_2.png"; } elseif ($vote_average >= 3 && $vote_average < 4) { $url = $config->urls->templates . "styles/images/stars_3.png"; } elseif ($vote_average >= 4 && $vote_average < 5) { $url = $config->urls->templates . "styles/images/stars_4.png"; } elseif ($vote_average = 5) { $url = $config->urls->templates . "styles/images/stars_5.png"; } ?> <h5>Current rating:</h5> <p><img src="<?php echo $url; ?>" width="100" height="25" alt="<?php echo $page->name . " - " . $vote_average . " stars"; ?>"/><span> (<?php echo $vote_average . "/5"; ?>)</span></p> <?php } ?> <?php $rating = $page->vote_score; $votes = $page->vote_count; $out = ""; if (isset($input->post->submit_rating) && $input->post->test == "") { $out = "<h5>Thank you for rating!</h5>"; $new_rating = $input->post->rating + $rating; $votes++; $page->of(false); $page->set("vote_score", $new_rating); $page->set("vote_count", $votes); $page->save(); $voted = true; $page->of(true); // set cookie to ensure only 1 vote (not foolproof!) setcookie('voted',$page->name,time() + (86400 * 7)); echo $out; ?> <?php } elseif(isset($_COOKIE['voted']) && $_COOKIE['voted'] == $page->name) { echo "<br>You have already voted, thank you!"; } else { ?> <div id="rating_box"> <h4>Please feel free to rate this article!</h4> <form action="" method="post"> <select name="rating" id="rating">Your rating <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <input type="text" id="test" name="test"> <input type="submit" id="rating_submit" name="submit_rating" value="Submit rating"> </form> </div> <?php } ?> <a href="<?php echo $pages->get("/blog/")->url; ?>" id="back_blog_link">← Return to Blog</a> </div> <?php include("./footer_plain.inc"); ?>
  4. Hi, I'm working on creating a user driven ratings system where: A user can rate an item only once There is only one item on one page The user needs to login before rating The user can update /change his rating For doing this, I am planning to create a new page for every rating which will save the item, user and rating. However, if I have 10,000 items and 10,000 users and assuming everyone rates, there will be 100 Million pages created. Is this the best way to approach this, or is there a better way? Note: I am not using repeaters since they are not infinitely scalable.
×
×
  • Create New...