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

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

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

Post by Tata » Wed Dec 13, 2017 3:58 pm

I'll wait. But anyway, there is still the issue with 2lang. There is shown nothing even on localhost.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

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

Post by Tata » Wed Dec 13, 2017 4:06 pm

Added

Code: Select all

<?php if (function_exists('opcache_invalidate')) opcache_invalidate(__FILE__)?>
into the template: no change so far.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

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

Post by cmb » Wed Dec 13, 2017 4:55 pm

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.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

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

Post by Tata » Wed Dec 13, 2017 5:56 pm

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>
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

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

Post by cmb » Wed Dec 13, 2017 6:14 pm

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.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply