This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
plugins:tips [2014/02/07 10:05] datiswous [Working around the Lack of a Page-Delete Hook in 2.03] |
plugins:tips [2014/02/07 10:05] datiswous [Displaying custom and localized Dates] |
||
---|---|---|---|
Line 37: | Line 37: | ||
Assume you have 3 variables, ''$isSuccess'', ''$canUndo'' and ''$msg'' holding the message. To display the message for your plugin ''myplugin'', add the following code to your plugin: | Assume you have 3 variables, ''$isSuccess'', ''$canUndo'' and ''$msg'' holding the message. To display the message for your plugin ''myplugin'', add the following code to your plugin: | ||
- | <code> | + | <code php> |
<?php | <?php | ||
if (isset($msg)) { | if (isset($msg)) { | ||
Line 58: | Line 58: | ||
The publication date in the page XML files is stored in an english text format, which can be converted to a UNIX timestamp with | The publication date in the page XML files is stored in an english text format, which can be converted to a UNIX timestamp with | ||
- | <code> | + | <code php> |
$timestamp = strtotime($data->pubDate); | $timestamp = strtotime($data->pubDate); | ||
</code> | </code> | ||
Line 66: | Line 66: | ||
To display a truly localized date, use: | To display a truly localized date, use: | ||
- | <code> | + | <code php> |
$dateLocale = 'de_DE,de,ger,deu'; // or use $LANG or a setting in your plugin, | $dateLocale = 'de_DE,de,ger,deu'; // or use $LANG or a setting in your plugin, | ||
// for OS compatibility multiple locales should be possible | // for OS compatibility multiple locales should be possible |