| The following warnings occurred: | |||||||||||||||
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.30 (Linux)
|
![]() |
|
Brain tickler if you're bored - Printable Version +- Madison Motorsports (https://forum.mmsports.org) +-- Forum: Madison Motorsports (https://forum.mmsports.org/forumdisplay.php?fid=3) +--- Forum: Lounge (https://forum.mmsports.org/forumdisplay.php?fid=6) +--- Thread: Brain tickler if you're bored (/showthread.php?tid=5601) Pages:
1
2
|
- JackoliciousLegs - 03-14-2007 white_2kgt Wrote:sure I am, and I'm doing a better job at it than YOU.Spoken like a true ignorant ass white_2kgt Wrote:You shouldn't be computing this stuff in your View, compute everything you need in the controller and give it to your view to display.I'm obviously working in a restricted environment where I have limited access to the data I need access to. I only have access to the view. The controller area is off limits to me. It's not a big deal. There's obviously an easy solution using conditional logic. I just figured it'd be fun to figure out a way to do it otherwise. - Apoc - 03-14-2007 I agree it seems like it should be easy without conditional logic but certainly that stuff exists because it was easier than the alternative. Damn this turned uber1337... my head hurts. ~checks out of thread~ - HAULN-SS - 03-14-2007 you gonna post your one line answer? - white_2kgt - 03-14-2007 JackoliciousLegs Wrote:white_2kgt Wrote:sure I am, and I'm doing a better job at it than YOU.Spoken like a true ignorant ass so ask them to provide you with the information you need, that shouldn't be that hard, you should NOT be doing IF's when's, etc in the VIEW. - Maengelito - 03-14-2007 i bet the answer is either 1 or 0 or involves a combination of 1's and 0's - JackoliciousLegs - 03-14-2007 HAULN-SS Wrote:you gonna post your one line answer?I'll post my answer tomorrow. - JackoliciousLegs - 03-14-2007 white_2kgt Wrote:so ask them to provide you with the information you need, that shouldn't be that hard, you should NOT be doing IF's when's, etc in the VIEW.Again, I'd love to. But I can't. So I ask a fun brain teaser. That's what I do :-) - JackoliciousLegs - 03-15-2007 Nobody could get it eh? Well, here are the two solutions I have: With ternary $cur_pagesize = ($cur_page * $pagesize > $total_results) ? ($total_results % $pagesize) : $pagesize; Without $cur_pagesize = ($pagesize + (floor($cur_page / ceil($total_results / $pagesize))) * (($total_results % pagesize) - $pagesize)); - white_2kgt - 03-15-2007 JackoliciousLegs Wrote:Nobody could get it eh? Well, here are the two solutions I have: floor and ceil are FUNCTIONS, you didn't say you had access to FUNCTIONS!!! God that's slower than the ternary |