Jump to content

PWaddict

Members
  • Posts

    926
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by PWaddict

  1. The %X format doesn't work very well for some locales in a combination with %p format but there is a far better and easier way to get the correct time format without the seconds on each locale. With the following method you can control all of the time outputs from all your datetime fields from just 1 field under each language! Create a text field and name it: time_format. Add the time_format field on the system's language template (Setup > Templates > Filters > Show system templates). Go to each of your languages under Setup > Languages and add their strftime format on the time_format field. For example if the language locale is en_US.utf8 then the time format should be %l:%M %P if the locale is fi_FI.utf8 the time format should be %H.%M and so on. Add the following code to your _init.php: $time_format = $user->language->time_format; and add this code on your templates you want to output the time from your datetime field: <?= strftime($time_format, $page->getUnformatted("your_datetime_field")) ?> DONE
  2. Hello Andreas_D and welcome to PW community Is this http://github.hubspot.com/pace/docs/welcome/ what you're looking for?
  3. Unfortunately this code isn't working for all locales cause for example in Finland they use dots (.) instead of colons (:). I will check all the locales and adjust the code soon.
  4. I think so! I will wait for the next dev release to test it.
  5. You can check all the time formats for strftime here.
  6. That is very specific. It only displays the 12-hour format. My method displays the time based on each locale and without the seconds. For example some countries have 24-hour format and others the 12-hour etc.
  7. Here is the solution: <?php $oldtime = strftime("%X", $page->getUnformatted("tour_date")); echo $newtime = substr($oldtime, 0, strpos($oldtime, ':', strpos($oldtime, ':')+1)) . " " . strftime("%p", $page->getUnformatted("tour_date")); ?> Now I'm getting the time formats based on each locale without the seconds: Locale en_US.utf8 = 12:00 AMLocale es_ES.utf8 = 00:00Locale el_GR.utf8 = 12:00 πμ If you know a better method please feel free to share it!
  8. I found the solution. I have to replace the slashes on each file value from the json files for each language. This is from localhost: "file": "wire\\modules\\LanguageSupport\\LanguageSupport.module", Must be changed to this in order to work on the server: "file": "wire\/modules\/LanguageSupport\/LanguageSupport.module", The funny thing is that I changed them on localhost too and they working fine. So the question is why on localhost have been used the 2 backslashes instead of the 1 backslash and 1 forward slash?
  9. In order to uninstall LanguageSupport.module I have to first uninstall LanguageSupportFields.module, LanguageSupportPageNames.module and LanguageTabs.module and PW won't let me uninstall the LanguageSupportFields.module because there are fields with multi-language values.
  10. But if I uninstall the Language Support module all the language related values will be gone from everywhere. A temporary solution is to delete all the translations files and find them again.
  11. I'm using the following method to display the time based on each locale: <?= strftime("%X", $page->getUnformatted("tour_date")) ?> Here are the results: Locale en_US.utf8 = 12:00:00 AM Locale es_ES.utf8 = 00:00:00 Locale el_GR.utf8 = 12:00:00 πμ How can I remove the seconds (:00) ?
  12. I transferred a site from localhost (XAMPP Windows) to a live server (Linux) and it's impossible to edit the translations files. When I try to edit for example the LanguageSupport.module I'm getting this error: Session: File does not exist: /wire\modules\LanguageSupport\LanguageSupport.module (translation file not needed? textdomain: wire--modules--languagesupport--languagesupport-module) I'm guessing the issue is caused because of the slashes: On localhost the paths for translation files are using backslashes: \wire\modules\LanguageSupport\LanguageSupport.module while on a live server the paths are using forward slashes: /wire/modules/LanguageSupport/LanguageSupport.module
  13. I'm not familiar with hooks but if you want you can try the Setup Page Name module to do what you want.
  14. Here is an alternative method that actually solved my problem where I was getting a unix timestamp: <?= $order->getFormatted("pad_paid") ?> If you know more methods feel free to share them.
  15. Beside using the below method for displaying a datetime field with it's multi-language formats, are there more methods for doing the same thing? <?= utf8_encode(strftime($order->pad_paid)) ?> I'm not looking for methods with hardcoded multi-language values like this one: <?= utf8_encode(strftime("%b %d, %Y", $order->getUnformatted("pad_paid"))) ?>
  16. 1. Put the _init.php under site/templates directory. 2. Add the following code on the site/config.php file and you're ready: /** * Prepend template file * * PHP file in /site/templates/ that will be loaded before each page's template file. * Example: _init.php * * @var string * */ $config->prependTemplateFile = '_init.php';
  17. /** * Prepend template file * * PHP file in /site/templates/ that will be loaded before each page's template file. * Example: _init.php * * @var string * */ $config->prependTemplateFile = '_init.php';
  18. Try updating PW to the latest version: 3.0.66.
  19. I'm using it on PW & Padloper templates and it's working fine. Although I haven't tested yet the email templates from Padloper. If you want post all the steps required in case I need to do your method.
  20. @Peter Knight Here is exactly what you need to do: Create a new file under templates: _translations.php. Inside add all your translatable words or phrases like this: $page->__product_drawing = __('Product Drawing'); $page->__buy_now = __('Buy Now'); $page->__read_more = __('Read more'); Then on your _init.php add this: include_once("./_translations.php"); Then on the templates you want to display for example the "Product Drawing" add this: $page->__product_drawing Now all you have to do is to go on your Languages under admin and then find the file _translations.php and start translating all the strings you have there.
  21. The latest update of the module was on 1 April 2014. My above simple request to add a missing icon hasn't fulfilled yet! Maybe @Wanze isn't available. I'm using the module on both PW2 & PW3 with https and it's working fine. You can install a module with 3 methods: 1. Add Module From Directory 2. Add Module From URL 3. Add Module From Upload Go to Admin > Modules and click on the tab "New" to check all the methods.
  22. Hi @adrian and welcome back Thanks for the fix on the first problem. Now about the 2nd problem, I deleted that cause I wanted to do more testing. So here is the full problem... Problem (1st part): If I add a title on an additional language field eg. "Test" where that exact title "Test" is already on another page's additional language field from the same template when I save the page the title disappears and I'm getting the error: Session: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'test-1018' for key 'name1977_parent_id'. Problem (2nd part): If I add a title on the default language field eg. "Test" where that exact title "Test" is already on another page's default language field from the same template the page saved as /test-1 for all languages which is correct BUT if on that page (/test-1) add the same title "Test" on an additional language field the page name for that language will be saved as /test which is wrong cause now I have 2 pages with the same page names. Solution: Page name for additional language should be checked if already exists and name it properly just like it happens on the default language: Session: Changed page URL name to "test-1" because requested name was already taken.
  23. As far I know the only fix is to disable mod_security. You should contact your hosting provider.
  24. This might be caused by mod_security. Add the below code on top of your .htaccess file and try again to save the page. <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
  25. Wow you fixed that issue. Now it's working properly. Thank you so much
×
×
  • Create New...