Page_params, Yanp formatdata

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
Termin
Posts: 101
Joined: Thu Jan 27, 2011 8:55 am
Contact:

Page_params, Yanp formatdata

Post by Termin » Thu May 21, 2015 7:20 pm

Hi Community,

How to use an array for the plugin Page_params and Yanp?

Code: Select all

$month_names = array('Декабрь', 'Январь',  'Февраль',  'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь' );

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

Re: Page_params, Yanp formatdata

Post by cmb » Thu May 21, 2015 7:55 pm

Termin wrote:How to use an array for the plugin Page_params and Yanp?
Good point! I think it's time to think about a general solution for localized month names (and date representations in general).

As a quick workaround: find function XH_formatDate() in cmsimple/functions.php. There you can replace the `return`statement with the following:

Code: Select all

    return strftime($tx['lastupdate']['dateformat'], $timestamp); 
That may already be sufficient for page_params (assuming that $tx['lastupdate']['dateformat'] is set accordingly).

If that doesn't work, you can set $tx['locale']['all']="ru_RU.UTF-8" or $tx['locale']['all']="uk_UA.UTF-8". That may work, or not, depending on your server.

To use this function also for Yanp_XH, change plugins/yanp/index.php line 160:

Code: Select all

    .'<p><em>'.XH_formatDate(yanp_timestamp($pd)).'</em></p>'."\n"
Christoph M. Becker – Plugins for CMSimple_XH

Termin
Posts: 101
Joined: Thu Jan 27, 2011 8:55 am
Contact:

Re: Page_params, Yanp formatdata

Post by Termin » Tue May 26, 2015 1:16 pm

Hi cmb.
Not one method is not working.

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

Re: Page_params, Yanp formatdata

Post by cmb » Wed May 27, 2015 11:31 am

Termin wrote:Not one method is not working.
Well, then you can try the following:

Code: Select all

function XH_formatDate($timestamp)
{
    global $tx;

    $month_names = array('Декабрь', 'Январь',  'Февраль',  'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь' );
    $month_name = $month_names[date('n', $timestamp)];
    return sprintf(date($tx['lastupdate']['dateformat'], $timestamp), $month_name);
} 
Also you have to change in ru.php:

Code: Select all

$tx['lastupdate']['dateformat']="d %\\s Y, H:i"; 
Alternative: try http://cmsimplewiki.com/doku.php/tips_a ... customized.
Christoph M. Becker – Plugins for CMSimple_XH

Termin
Posts: 101
Joined: Thu Jan 27, 2011 8:55 am
Contact:

Re: Page_params, Yanp formatdata

Post by Termin » Fri May 29, 2015 6:40 pm

This method is also not working.

Post Reply