# |
Jul 12th 2017, 09:21 |
dereuromark |
Displaying is easy, but how to transform back to UTC the proper way? |
# |
Jul 12th 2017, 09:20 |
dereuromark |
See https://github.com/cakephp/cakephp/issues/10877 |
# |
Jul 12th 2017, 09:20 |
dereuromark |
How do other people handle the timezone issue with form inputs for datetime? I still have conversion problems here. |
# |
Jul 12th 2017, 09:20 |
dereuromark |
thats exactly how cake does it in the form helper, too :slightly_smiling_face: |
# |
Jul 12th 2017, 09:19 |
wouter0100 |
Ah, after reading some docs (outside cakephp) I found out the reason. Now using POST method with X_HTTP_METHOD_OVERRIDE. WOrks awesome. |
# |
Jul 12th 2017, 08:57 |
jarard01 |
that's fine - just need to outout to the screen in this format - not my decison |
# |
Jul 12th 2017, 08:57 |
neon1024 |
Or the helper, sure. Didn’t know there was a method in the helper :slightly_smiling_face: TIL |
# |
Jul 12th 2017, 08:57 |
jarard01 |
$this->Number->format |
# |
Jul 12th 2017, 08:56 |
neon1024 |
If you try and do any maths on the value, stuff will break because it has a comma in it ;) |
# |
Jul 12th 2017, 08:56 |
neon1024 |
Do bear in mind that number_format returns a string! |
# |
Jul 12th 2017, 08:56 |
neon1024 |
http://php.net/number_format |
# |
Jul 12th 2017, 08:56 |
neon1024 |
Yes, you can use `number_format()` |
# |
Jul 12th 2017, 08:55 |
jarard01 |
however currency is not quite what I need, is it possible to format 1250 as 1,250 without any currency symbol |
# |
Jul 12th 2017, 08:54 |
jarard01 |
i lied, that does work |
# |
Jul 12th 2017, 08:53 |
neon1024 |
Perhaps the helper isn’t loaded in your AppView.php |
# |
Jul 12th 2017, 08:53 |
jarard01 |
i'm sure i tried that and received an error about a non-oject |
# |
Jul 12th 2017, 08:53 |
neon1024 |
Ah, I see, you can use both! :) |
# |
Jul 12th 2017, 08:53 |
neon1024 |
https://book.cakephp.org/3.0/en/views/helpers/number.html#formatting-currency-values |
# |
Jul 12th 2017, 08:52 |
neon1024 |
Use the helper surely? `$this->Number->currency()` |
# |
Jul 12th 2017, 08:51 |
jarard01 |
hmm that works |
# |
Jul 12th 2017, 08:51 |
anvyst |
@jarard01 try calling it with full namespace, to troubleshoot if you have namespace issue somewhere in the code? Cake\I18n\Number::currency(1.23, 'GBP'); |
# |
Jul 12th 2017, 08:48 |
jarard01 |
in my controller: use Cake\I18n\Number; |
# |
Jul 12th 2017, 08:47 |
jarard01 |
Class 'Number' not found |
# |
Jul 12th 2017, 08:47 |
jarard01 |
in ym template I have: echo Number::currency($price->price, 'GBP'); |
# |
Jul 12th 2017, 08:45 |
wouter0100 |
No JSON payload, just plain old form-data (even without the file, it won't work.) |
# |
Jul 12th 2017, 08:45 |
wouter0100 |
Hmm, anyhow experience with multipart/form-data PUT requests? I can't seem to get this working in Cake. `$this->request->env('CONTENT_TYPE')` returns `multipart/form-data; boundary=----WebKitFormBoundaryMcruL0mBMI9UJuAQ`, ->input() returns the payload in unparsed format (with the correct file/post fields) and ->data is empty.. |
# |
Jul 12th 2017, 08:40 |
neon1024 |
Although on reflection a middleware layer could probably take care of it quite easily |
# |
Jul 12th 2017, 08:40 |
neon1024 |
I’ll have a think about it, as doing something like that is a great way to fill gaps in my knowledge :thumbsup::skin-tone-2: |
# |
Jul 12th 2017, 08:39 |
neon1024 |
Would have to learn how it all works first I suppose :slightly_smiling_face: |
# |
Jul 12th 2017, 08:39 |
neon1024 |
@dereuromark Honestly, I’m not even sure where I’d start with that |
# |
Jul 12th 2017, 08:39 |
neon1024 |
I’ve never really understood the log levels properly. I always had trouble splitting stuff out, and found they always overlapped |
# |
Jul 12th 2017, 08:38 |
dereuromark |
write one :slightly_smiling_face: |
# |
Jul 12th 2017, 08:38 |
birdy247 |
:+1: |
# |
Jul 12th 2017, 08:37 |
neon1024 |
It would be super nice to be able to configure logging and error handling on an HTTP code basis |
# |
Jul 12th 2017, 08:37 |
dereuromark |
yeah, its still not part of the core, even though I highly recommend it :slightly_smiling_face: |
# |
Jul 12th 2017, 08:36 |
birdy247 |
I presume I would need a custom error handler to do that? |
# |
Jul 12th 2017, 08:36 |
neon1024 |
But many of our sites are medium term, so it’s not really viable in most cases |
# |
Jul 12th 2017, 08:35 |
neon1024 |
I guess we really should have a Cake plugin which implements Logstash, and pushes all the logs into a log server |
# |
Jul 12th 2017, 08:35 |
neon1024 |
We don’t really do much with logging at my work because we have so many sites |
# |
Jul 12th 2017, 08:35 |
neon1024 |
Yeah, that’s a good idea :slightly_smiling_face: |
# |
Jul 12th 2017, 08:34 |
birdy247 |
@dereuromark neon1024 I like the idea of logging them to a seperate file |