Brain tickler if you're bored
#21
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.

What are you using anyway?
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.
My Tumblr
2008 Felt F75 - Pedal Power
  Reply
#22
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~
'76 911S | '14 328xi | '17 GTI | In memoriam: '08 848, '85 944

"Here, at last, is the cure for texting while driving. The millions of deaths which occur every year due to the iPhone’s ability to stream the Kim K/Ray-J video in 4G could all be avoided, every last one of them, if the government issued everyone a Seventies 911 and made sure they always left the house five minutes later than they’d wanted to. It would help if it could be made to rain as well. Full attention on the road. Guaranteed." -Jack Baruth
  Reply
#23
you gonna post your one line answer?
2013 Cadillac ATS....¶▅c●▄███████||▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅||█~ ::~ :~ :►
2008 Chevy Malibu LT....▄██ ▲  █ █ ██▅▄▃▂
1986 Monte Carlo SS. ...███▲▲ █ █ ███████
1999 F250 SuperDuty...███████████████████►
1971 Monte Carlo SC ...◥☼▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙☼◤
  Reply
#24
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
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.

What are you using anyway?
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.

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.
  Reply
#25
i bet the answer is either 1 or 0 or involves a combination of 1's and 0's
1994 Ford Ranger
2004 Honda S2000
2007 BMW X3
  Reply
#26
HAULN-SS Wrote:you gonna post your one line answer?
I'll post my answer tomorrow.
My Tumblr
2008 Felt F75 - Pedal Power
  Reply
#27
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 :-)
My Tumblr
2008 Felt F75 - Pedal Power
  Reply
#28
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));
My Tumblr
2008 Felt F75 - Pedal Power
  Reply
#29
JackoliciousLegs Wrote: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));

floor and ceil are FUNCTIONS, you didn't say you had access to FUNCTIONS!!! God that's slower than the ternary
  Reply


Forum Jump: