Page 2 of 2

Re: Warning: A non-numeric value encountered in...

Posted: Wed Dec 13, 2017 3:58 pm
by Tata
I'll wait. But anyway, there is still the issue with 2lang. There is shown nothing even on localhost.

Re: Warning: A non-numeric value encountered in...

Posted: Wed Dec 13, 2017 4:06 pm
by Tata
Added

Code: Select all

<?php if (function_exists('opcache_invalidate')) opcache_invalidate(__FILE__)?>
into the template: no change so far.

Re: Warning: A non-numeric value encountered in...

Posted: Wed Dec 13, 2017 4:55 pm
by cmb
Tata wrote:I'll wait. But anyway, there is still the issue with 2lang. There is shown nothing even on localhost.
Hm, the "daily" pages need to have English names as well, since date('l', …) returns always English day names.
Tata wrote:Added

Code: Select all

<?php if (function_exists('opcache_invalidate')) opcache_invalidate(__FILE__)?>
into the template: no change so far.
That would only cause template.htm to be invalidated. You can try:

Code: Select all

<?php if (function_exists('opcache_reset')) opcache_reset()?>
However, there may be another cache active, or perhaps a bug in OPcache.

Re: Warning: A non-numeric value encountered in...

Posted: Wed Dec 13, 2017 5:56 pm
by Tata
cmb wrote:Hm, the "daily" pages need to have English names as well, since date('l', …) returns always English day names.
I was googling after some localisation but haven't found nothing. The EN day names make no big sense on another 2lang pages.
It seems, there would be some workaround - evaluating the number of the day with its equivalent in

Code: Select all

$day_name = explode(',', $plugin_tx['week_plan_xh']['day_names']);
    $day_name = array_map('trim', $day_name);
So it would actualise the call using language strings for

Code: Select all

                         <div class='w_plan_next_day'>" . 
                              newsbox(date('l', strtotime(' + 1 day'))) .     
                         "</div>

Re: Warning: A non-numeric value encountered in...

Posted: Wed Dec 13, 2017 6:14 pm
by cmb
Tata wrote:I was googling after some localisation but haven't found nothing.
Well, there is strftime(), but this relies on the locale setting, which is not really reliable on multi-threaded web servers. Furthermore, there is IntlDateFormatter, but the Intl extension is often unavailable.
Tata wrote:The EN day names make no big sense on another 2lang pages.
These won't be shown to visitors, though, so if the admin has basic English skills, sticking with English day names appears to be acceptable.
Tata wrote:It seems, there would be some workaround - evaluating the number of the day with its equivalent in

Code: Select all

$day_name = explode(',', $plugin_tx['week_plan_xh']['day_names']);
    $day_name = array_map('trim', $day_name);
So it would actualise the call using language strings for

Code: Select all

                         <div class='w_plan_next_day'>" . 
                              newsbox(date('l', strtotime(' + 1 day'))) .     
                         "</div>
Well, you could call newsbox() like so:

Code: Select all

newsbox($day_name[date('w', strtotime('+ 1 day'))])
IOW: get the number of the day of the week (0 - 6), get the respective day name from the language texts, and call newsbox for this day name.