Jump to content


Popular Content

Showing content with the highest reputation on 12/26/2018 in all areas

  1. 4 points
    Hello friends here a small config for quickly using composer and processwire https://github.com/joyofpw/docker 😄
  2. 3 points
    This post by Ryan shows how you can do it. I've never done it on my own, so I'd be happy to see a step by step guide that I might add to my custom admin pages tutorial!
  3. 2 points
    @ryan Right now the view that shows translation files "Setup > Languages > German" is not very intuitive and confuses users and translators, because they are confronted with cryptic names (Textdomains) instead of clear to read names. How can we make it better? Add clear to read labels like the module name from modules and the filename without the path from other files (.php). The path information has to be more subtle, as it is not that important for most users Take a look at the first two entries compared to the lower two. This can be done very quickly by adding some styles. Either flexbox or floats would do the job. Here is what I did (just quick and dirty and not the best way) Changed order of the file path to last. Added CSS to InputfieldFileLanguageFilename description: <span class="InputfieldFileLanguageFilename description" style=" position: absolute; right: 0; padding-right: 10px; font-size: 13px; color: #ccc; ">/site/templates/main.php</span> What you think of that?
  4. 2 points
    I think I have found an issue which affects the "Live Search" feature of PW on edit language pages. The info for manually loading assets contains html markup, and even they are inside "```" quotes they make the Live Search choke ("invalid character at ..."). The JS error made the whole index file of Live Search outputted on the page and broke other JS functionality. It was not easy to track down, first I though it's AOS, then Tracy but finally it turned out to be this module (the reported line and column was not entirely proper). What made it even harder that you have to manually clear the Live Search cache and rebuild the index to test. This page can be found at "/setup/languages/edit/?id=1041", and the index file is at /site/assets/files/1041/.phrase-index.txt (use an existing language ID). First I tried to use only one "`" quote, then adding extra double quotes, etc. but nothing worked. Finally I replaced starting and closing html tags with their html entities and it worked well: array( 'type' => 'checkbox', 'name' => 'autoload_assets', 'label' => __('Autoload Assets'), 'description' => __('Autoload module CSS and JS files.'), 'notes' => __("If you disable this, you will need to load these files manually:\n```&lt;link rel='stylesheet' type='text/css' href='/site/modules/CookieManagementBanner/assets/css/CookieManagementBanner.css' /&gt;\n&lt;script defer src='/site/modules/CookieManagementBanner/assets/js/CookieManagementBanner.js'&gt;&lt;/script&gt;```\nNOTE: you must load the JS file with the defer attribute."), 'value' => 1 ), Let me know if you need more info.
  5. 2 points
    Created a request issue for this https://github.com/processwire/processwire-requests/issues/251
  6. 1 point
    I used this way very often in the past @benbyf <?php // create /site/modules/LanguageDefault // create file LanguageDefault.module // refresh modules in PW admin // https://processwire-recipes.com/recipes/change-homepages-default-language/ class LanguageDefault extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'LanguageDefault', 'version' => 1, 'summary' => 'A work around to changing the default language.', 'href' => 'https://processwire.com/talk/topic/9322-change-default-language-for-homepage/?p=89717', 'singular' => true, 'autoload' => true, ); } /** * Initialize the module * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. * */ public function init() { $this->session->addHookBefore('redirect', $this, 'setDefaultLanguage'); } public function setDefaultLanguage($event) { if ($this->page->id == 1 && $event->arguments(0) == $this->page->localUrl('default')) { $event->arguments(0, $this->page->localUrl('de')); } } } Found at: https://processwire-recipes.com/recipes/change-homepages-default-language/
  7. 1 point
    @SwimToWin There RecureMe module for managing of recuring dates
  8. 1 point
    Typo inTracyDebugger.module.php, line 2688: reponse -> response.
  9. 1 point
  10. 1 point
    Just one additional comment to @LostKobrakai's great reply. HTML5 sessionStorage is basically the same as HTML5's localStorage except that it is only stored for the current session whereas localStorage is kept forever unless intentionally cleared.
  11. 1 point
    The text is talking about server side session handling. The default in php is to store files in the filesystem with session identifiers, which historically was more prone to security issues on shared hostings than the database. Most services I use nowadays got their filesystem permissions properly under control though, so this hopefully is a thing of the past. Php does also support other storages for sessions out of the box like redis or memcache. ProcessWire also comes with SessionHandlerDB, which stores the session identifier in the MySQL database next to all the other data it needs to store. This is an easy solution, but makes your application more difficult to scale independently depending on the load you get. $session is the API variable, by which you work with said php session of users in ProcessWire. Everything mentioned by now is totally unrelated to client side storage like the html5 sessionStorage. This has the name "session" in it not because it somehow relates to server side session handling, but because it lasts only for a certain browser session a.k.a. it's wiped as soon as you close your browser. It's just a property for the "Storage" it provides in terms of expiration of data. Depending on what you want to do server side sessions and the sessionStorage of your browser can both provide a solution, but ultimately they work vastly different and you need to decide based on the tradeoffs what you should ultimately use.
  12. 1 point
    Apparently, Foxy can handle subscriptions... might be worth a look. There's also Snipcart. And Mollie.
  13. 1 point
    You can use this to resize via mouse (using jQuery UI Resizable which seems to be present in the PW admin). I haven't checked fieldsets, I've updated the code, it's working fine with fieldsets too.
  14. 1 point
    I'm not entirely sure I know how to answer all your questions here because it sounds like you may trying to do things with InputfieldFile is may not necessarily be designed for. If that's the case, you may be better off extending it as a new PHP class, or copying its code to new module, rather than trying to achieve these all with hooks. Another thing I'm not sure about is whether you are talking about a front-end or back-end context. If dealing with a front-end context, the ajax uploading will not work. In some cases you may have to disable it on back-end use too (see the commented line below for how to do that). InputfieldFile is really meant to be used in combination with FieldtypeFile and within the page editor. But it is possible to use it outside of that context. Though you will still need to supply it a Page object so it has a known storage location, but the given Page doesn't need to have a files field. Meaning, it can be any Page, even an admin one. Here's an example of how you might use InputfieldFile on it's own: // page the file will be stored with (doesn't have to have a files field) $myPage = $pages->get('/path/to/your/page/'); // optionally set the name of existing file(s) that will be present (or leave it blank) $myFiles = array( $myPage->filesManager->path . 'myfile.txt' ); // file extensions you allow $myExts = 'pdf csv txt'; // -------------------------------------------- // create the form $form = wire('modules')->get('InputfieldForm'); // create the files field $f = wire('modules')->get('InputfieldFile'); $f->name = 'my_files'; $f->label = 'My Files'; $f->extensions = $myExts; $f->overwrite = true; // $f->noAjax = true; // uncomment if necessary $pagefiles = new Pagefiles($myPage); foreach($myFiles as $filename) { $pagefile = new Pagefile($pagefiles, $filename); $pagefiles->add($pagefile); } $f->attr('value', $pagefiles); $form->add($f); // add a submit button $f = wire('modules')->get('InputfieldSubmit'); $f->attr('name', 'submit_form'); $form->add($f); // ------------------------------------------- // process the form if(wire('input')->post('submit_form')) { $form->processInput(wire('input')->post); $pagefiles = $form->get('my_files')->value; foreach($pagefiles as $pagefile) { echo "<p>Your file: $pagefile->url</p>"; } }
  • Create New...