Jump to content

PWaddict

Members
  • Posts

    908
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by PWaddict

  1. Ok got it. I had to access children of children. The $release is from another foreach loop where I'm getting the page's children and with the below code I'm getting the children of children with only one and lowest value from a float field. <?php foreach($release->children("limit=1, sort=pad_price") as $p) { ?> <?= $cart->renderPriceAndCurrency($p->pad_price) ?> <?php } ?>
  2. Nice! Do you have to change your module version from 1.2.1 to 1.2.2 to appear on ProcessWire Upgrades?
  3. @Wanze Just sent you a pull request. Thank you.
  4. How to echo only one value (the lowest one) of a float field from a Page Table?
  5. I've tested the new 3.0.68 version and the problem still exists. I have to manually replace the slashes.
  6. You're right. Both parts of the problem are caused by the core. Can you please forward it to @ryan so maybe he can fix it on the next dev release?
  7. I had the same problem. Everything was fine on XAMPP but not on the live server. The reason is that on the server there is an apache module installed called mod_security. Add the following code on top of your .htaccess file and the problem will be fixed. <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
  8. 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
  9. Hello Andreas_D and welcome to PW community Is this http://github.hubspot.com/pace/docs/welcome/ what you're looking for?
  10. 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.
  11. I think so! I will wait for the next dev release to test it.
  12. You can check all the time formats for strftime here.
  13. 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.
  14. 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!
  15. 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?
  16. 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.
  17. 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.
  18. 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) ?
  19. 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
  20. I'm not familiar with hooks but if you want you can try the Setup Page Name module to do what you want.
  21. 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.
  22. 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"))) ?>
  23. 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';
  24. /** * 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';
  25. Try updating PW to the latest version: 3.0.66.
×
×
  • Create New...