Jump to content

rick

Members
  • Content Count

    430
  • Joined

  • Last visited

  • Days Won

    5

rick last won the day on December 26 2015

rick had the most liked content!

Community Reputation

475 Excellent

About rick

  • Rank
    Sr. Member

Contact Methods

  • Website URL
    https://simulatedconcepts.com

Profile Information

  • Gender
    Male
  • Location
    Texas
  • Interests
    Web applications, scotch, hunting, fishing, scotch, graphic design. Did I mention scotch?

Recent Profile Visitors

3,392 profile views
  1. Thanks @Robin S! That is a great solution. I'll close this out now.
  2. Okay, here is a workaround. I call it a workaround, because one, it works for what I need, and two, this will present problems when I have to process all 5K+ pages for each of the three parent pages in this current project. Here is the tracy code: $p = $pages->findMany("template=my_template"); // 34 total $s = array(); foreach( $p AS $m ) { $s[$m->id] = $m->comments->stars(true); } arsort($s); $s = array_slice($s,0,12,true); d($s); Produces this result: array (12) 1064 => 5.0 1121 => 5.0 1120 => 4.75 1056 => 4.5 1065 => 4.43 1054 => 4.41 1068 => 4.33 1086 => 4.3 1122 => 4.29 1062 => 4.25 1127 => 4.25 1058 => 4.22
  3. Well, sorting by stars seems to not work. When I expand the test data the sort fails. Here is the tracy test code... $p = wire('pages')->findMany('template=my_template,sort=-comments.stars,include=all,limit=12');//34 total pages foreach( $p as $m ) { $stars = $m->comments->renderStars(true, array('schema'=>'microdata','partials'=>true)); echo $m->id.': '.$stars.'<br />'; } which gives the following results... 1027: ★★★★★4/5 (7 ratings) 1068: ★★★★★★4.3/5 (6 ratings) 1148: ★★★★★★3.8/5 (17 ratings) 1086: ★★★★★★4.3/5 (10 ratings) 1056: ★★★★★★4.5/5 (2 ratings) 1114: ★★★★★4/5 (9 ratings) 1057: ★★★★★4/5 (7 ratings) 1120: ★★★★★★4.8/5 (8 ratings) 1121: ★★★★★5/5 (3 ratings) 1063: ★★★★★★3.8/5 (12 ratings) 1064: ★★★★★5/5 (1 rating) 1065: ★★★★★★4.4/5 (14 ratings) Also notice that some ratings display 6 stars. The default config is set to 5. I am not concerned with sorting by the number of ratings, only the average ratings. Anyone have an idea what I am doing wrong?
  4. @wbmnfktr Yes it does. Even the fractional star rating, eg, 5, 4.75, 4.5 ... to 0 works.
  5. For other's and my reference: Sorting pages by stars requires the comment field name prefix, eg: // From previous post... $pc = $p->children('sort=-comments.stars, limit=12'); // Returns pages with 5 stars, then 4.5 stars, etc. I must have mistyped the comment field name before. My apologies. Thanks for your help @dragan.
  6. $this->halt(); As shown at the bottom of this thread. Is this what you are referring to?
  7. Yes Sir, I've tried a few combinations with the same results. I haven't seen anything in the source regarding an average other than the public function stars itself.
  8. @dragan, I'm using the core comments with star rating field type. Yes, the test code doesn't return any errors... // Tracy console $p = wire('pages')->get('template=my_template,include=all'); if($p->hasChildren) { $pc = $p->children('sort=stars, limit=12'); // One of many combinations I've tried d($pc); } But the results (12) are not sorted by stars, rather the results are returned in the order the pages were created (Id)... total => 34 start => 0 limit => 12 pager => "1 to 12 of 34" (13) items => array (12) Page:0 => array (5) ... Page:11 => array (5) selectors => "parent_id=1026, sort=stars, limit=12, status<1024" (49) [edit] Also, each template has the comments (fieldtypecomment) and stars are enabled.
  9. Howdy all, Is there a means to return pages sorted by star ratings? I apologize if I have missed a topic, but I haven't found anything related with my searches. Thanks for your help!
  10. I believe what you are looking for might be answered here.... If not, please elaborate and someone will jump in and help.
  11. Hello all. I've been lookin' at this for a couple of days now with no luck. I have a localhost test site where I set up an example as shown in example #2 in this article. The test template has page numbers enabled. There are 20 pages using the test template. $results = wire('pages')->find("template=test,sort=-published,limit=12"); $pagination = $results->renderPager(); echo $pagination; foreach($results as $result){ blah, blah, blah } The pager is rendered correctly, ie., 1 2 Next, including the link href attributes: ?page=2 for the second and Next links. The problem is the same pages are returned regardless of which link I click. There are no error messages. The response header shows page 2. Tracy shows the following for $results: count => 12 total => 20 start => 0 limit => 12 pager => "1 to 12 of 20" (13) items => array (12) What am I missing? Thanks for your help!
  12. It's been acting this way for the past 2 weeks for me.
  13. You have three forms on one page, so provide a hidden element with a unique name (as @horst suggests), then test for the form name when submitted and process accordingly. The page with your forms... <form> <input type="hidden" name="form1" value="form1" /> ... // Your form data collection fields </form> ... <form> <input type="hidden" name="form2" value="form2" /> ... // Your form data collection fields </form> ... <form> <input type="hidden" name="form3" value="form3" /> ... // Your form data collection fields </form> Then within your page, test for each... <?php if( $input->post->form1 == "form1" ) { // process your data and send your message for option 1 } elseif ( $input->post->form2 == "form2" ) { // process your data and send your message for option 2 } elseif ( $input->post->form3 == "form3" ) { // process your data and send your message for option 3 } // render your page as normal
×
×
  • Create New...