Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/18/2018 in all areas

  1. A very simply library that quickly allows localisation of country, language and currency names into various locales. It's based on the data from Umpirsky's country-list project. I started writing this back in 2014 but have finally got around to publishing it. I hope this is of use to some of you. Usage Examples... To create a localisation for a particular locale, first create a new instance and define the locale... $de_DE = wire('modules')->get('LibLocalisation')->setLocale('de_DE'); You can now use your locale to get information about countries, currencies and languages as they are used in that locale. For example, to output the names of various countries you use the country() method, passing in an ISO 3166-1 2alpha country code... echo $de_DE->country('CH'); // Outputs "Schweiz" - the German for Switzerland. echo $de_DE->country('AU'); // Outputs "Australien" - the German for Australia. echo $de_DE->country('US'); // Outputs "Vereinigte Staaten" - ditto for the United States of America. You can create as many instances of the module as you need and set them all up for the same, or different, locales. To access currency data, you call the currency() method, passing in the 3-letter currency code you are interested in. echo $de_DE->currency('GBP'); This returns an array of data about GBP - localised in German... [ digits => 2, number => "826", symbol => "£", name => "Britisches Pfund Sterling" ] Finally, you can output localised language names by calling the language() method and giving it a 2 letter language code. echo $de_DE->language('fr'); // Outputs "Französisch" - the German for French. Getting the Module... You can view the project on Github or in the module repository.
    6 points
  2. Hmm ok , did some testing . Testserver is a synology disk station whith 8 G ram. The import ccript is pretty simple : <?php namespace ProcessWire; include "index.php"; // Include PW include "berufe.php"; // Simple array with about 25000 Job names /* $berufe = array( array('id_beruf' => '1','berufsbezeichnung' => 'Aalbrutzüchter/in','kldb2010' => '11412'), array('id_beruf' => '2','berufsbezeichnung' => 'Aalfischer/in','kldb2010' => '11422'), array('id_beruf' => '3','berufsbezeichnung' => 'Aalräucherer/-räucherin','kldb2010' => '29242'), ... */ foreach ($berufe as $beruf){ echo $i++. " " .$beruf['kldb2010']." ".$beruf['berufsbezeichnung']."\n"; $p = new Page(); $p->template = 'berufsbezeichnung'; $p->parent = '/einstellungen/berufi/'; $p->title = $beruf['berufsbezeichnung']; $p->schluessel = $beruf['kldb2010']; $p->save(); } It took about 60 minutes to import using a PW installation whith Inno DB It took about 40 minutes using an installation whith MyIsam Now i changed the script to use transactions: <?php namespace ProcessWire; include "index.php"; // Include PW include "berufe.php"; // Simple array with about 25000 Job names try { $database->beginTransaction(); foreach ($berufe as $beruf){ echo $i++. " " .$beruf['kldb2010']." ".$beruf['berufsbezeichnung']."\n"; $p = new Page(); $p->template = 'berufsbezeichnung'; $p->parent = '/einstellungen/berufi/'; $p->title = $beruf['berufsbezeichnung']; $p->schluessel = $beruf['kldb2010']; $p->save(); } $database->commit(); } catch(\Exception $e) { $database->rollBack(); } On InnoDB using transactions the script finished in about 10 Minutes. It seemed like the actual DB operation that happened after creating the transaction only took a few seconds, as the almost script imediately ended after the last echo. Possibly transactions are worth a closer look, if we do massive data handling.
    3 points
  3. HI @STA - welcome! There is this module: The other option is to use Tracy's File Editor panel to edit the files directly on the server - the Test mode can make this a pretty decent option.
    2 points
  4. You mean the $cookie etc. suggestions? This is what I get: I guess that's the setting mentioned in the extensions docs:
    2 points
  5. @kongondo and @bernhard I am happy, that you like Intelephense. I just installed it, because it was recommended in the plugins list and has many installations. ? It does indeed find many of the ProcessWire functions if you use the Functions API. Only thing confusing for me is, that it also lists every other PHP functions, which I don't need most of the time. I haven't made any configuration to this plugin yet or read the description. ? But I would be interested as well, if it would be possible to configure it to make it more specific for development with ProcessWire.
    2 points
  6. @AndZyk. Thanks to you and @bernhard, I'll now try intelephense. Bottom line is the snippets I created have no advantage over intelephense from what I've read and seen :-).
    2 points
  7. thx, I just tried that extension and it looks great! @kongondo I think his question was what is different from your version to normal intellisense? that's how it looks like with intelephense:
    2 points
  8. I was for a long time happy with Sublime Text and in fact I still am. But this deprecation note of my favorite Sublime Text theme convinced me to switch to another editor/IDE. I have made the switch to Visual Studio Code a few weeks ago and like it so far. There are a few things missing/confusing, but the switch was easy because most of the Sublime Text plugins I used are also available for VSC. ? Thank you for the snippets, but I was wondering about some things @kongondo: If I use the Functions API, are those snippets a improvement or should I count in this case on a plugin like f.e. Intelephense? Maybe you could make a extension out of those snippets? Regards, Andreas
    2 points
  9. ProcessWire API Visual Studio Code Snippets Here is a Gist of all (?) ProcessWire public API snippets for VSC. This is generated from the ProcessWire Cheatsheet. Some stuff needed manual cleanup. I also removed the stuff from the selectors section. I could have missed something, please let me know. Please note this is a complete, well-formed JSON file. If you need to copy to your existing VSC snippets file (most likely your php.json), remember to remove the top and bottom outermost curly braces. One great thing about VSC is that it doesn't care much about typos; fuzzy search will find what you meant to type. E.g., 'cnf' will match 'config'. Maybe the JSON file is too long, I don't know, but sometimes the snippets' descriptions don't show up. The snippets are for use in a template file (i.e., no auto $this->), but you can still use it in a module and/or modify it to suit such needs. Hope you find it useful :-). Demo
    2 points
  10. One more quick update. In addition to the existing shortcut keys for toggling the size of the code and results panes in the Console panel, I have added a new one: CTRL + SHFT + → Which resizes the code pane to the height of all the lines of code:
    2 points
  11. Hello fellow PW-ers! First post here, but I'm actually a relatively long time user. Today I finally came up with an issue that justifies asking for help. Does anyone know of a way to manage the templates directory from the admin interface? Something along the lines of the database backups module, that would allow me to upload a zip file and dump it over the files of the templates directory. I'm now facing a client that uses a dedicated server, has everything locked down, and has no FTP. They've setup PW for me, but now the only way for me to update the site is by sending them a zip that they then extract in the server. Imagine trying to fix problems and touching up markup like this. It's Hoover level of suck. Thanks for your time and help.
    1 point
  12. Welcome to the forums. ? The structure of the page tree (Page List) always reflects the path to pages on the front-end. That fact is part of the ProcessWire philosophy that Ryan has talked about somewhere (can't remember where exactly). So you can't have the Home page appear anywhere other than at the root of the page tree. In terms of having a dashboard instead of Page List there are several forum topics that are relevant. A Google search will find them: https://www.google.com/search?q=site:processwire.com+dashboard And here is another approach you can try... 1. Install the AdminOnSteroids module, and use the "Add pages to navigation" feature to add your Internal DB and Newsletter pages as custom nav items. This will add those pages to the Pages menu so that if you click them you'll see only those sections in Page List. 2. Add a hook to /site/ready.php (add the file if it doesn't exist) so that your Internal DB and Newsletter pages do not appear in the main Page List, so they are not confusing to your users. $wire->addHookAfter('Page::listable', function(HookEvent $event) { // Only for non-superusers if($this->user->isSuperuser()) return; // The ID of the page that Page List is listing children of $id = $this->input->get->int('id'); $page = $event->object; // Don't list pages with certain templates under Home (adjust template names as needed) if($id === 1 && ($page->template == 'internal_db' || $page->template == 'newsletter')) { $event->return = false; }; });
    1 point
  13. Ok the problem must be in my FireFox browser Edit: The File Editor is working perfectly in my Chrome browser, and also in my Opera browser (45.0) Thanks Adrian
    1 point
  14. Hey @kongondo - you tempted me to give VSCode another shot and using it now, but it looks like there is some weird matching going on. This popped up when I typed the closing ">" at the end of </div> Any thoughts? Thanks
    1 point
  15. Works for me. Can you please check for JS errors in the browser dev console. Any difference in another browser?
    1 point
  16. My bad sorry. I found the File Editor. But when I select a template file on the left, the editor window on the right does not update. The editor window on the right stays the same. Double clicking on a template file on the left does not make a difference, the editor window on the right always shows the same.
    1 point
  17. One more shortcut ? CTRL + SHFT + ENTER will toggle the Console in and out of fullscreen. Totally random, but a little tip about the Console panel - not only is it great for testing the PW API and PHP in general, it's also pretty nice for testing JS code out. Take this example of: calling an external API populating an element in the Console results pane with a property from the returned JSON logging the result to the browser dev console Why use this over the browser console, or CodePen, JSFiddle etc? Well, notice that the API call is grabbing a PW field from the current page: 'https://represent.opennorth.ca/postcodes/<?=$page->postcode?>/' Also, if you are a fan of the output of the Browser dev console, don't forget about Tracy's fl() option to dump objects direct to this. Anyway, hope there is something useful there if you hadn't thought about it before ?
    1 point
  18. Found a nice link about this topic: https://stackoverflow.com/questions/14675147/why-does-transaction-commit-improve-performance-so-much-with-php-mysql-innodb
    1 point
  19. imho it should work, maybe you can try it on a clean installation?
    1 point
  20. Not sure if this thread is still relevant? If it is, it seems cloning repeaters can be a pain ?? Btw, this: $block = $salespage->children("id={$duplicate_id},include=all")->first(); Can be shortened to this: $block = $salespage->child("id={$duplicate_id},include=all");
    1 point
  21. On the to-do list for the next version, is localisation of the input and output country names in the country select list (again thanks to @matjazp). To do this, I plan to release a module that I wrote for a different project back in 2014, but never got around to publishing: LibLocalisation. (It needs a little tidy-up first, as PW has progressed a long way since I first wrote it.) This module allows simple localisation of country names, language names and currencies. The Street Address module will leverage this, if it happens to be installed, to display the select list of countries in the language being used by the user's browser - and to localise the destination country name into the language(s) used in the origin country as this is the language that postal workers in the source country will be used to. There will be extra config options to control this. Following that, I plan to work on @thlinna's request to make this work with FormBuilder. Update:
    1 point
  22. Yeah, same here. I used Felix Becker's but was never happy with it. Need to do some testing with the linked one but first tests where promising. In the screencast you see that it even picks the "pagebreak" property from rockreplacer which would not be possible with snippets created from the cheatsheet Also, you get a nice preview and docs and you can use "go to definition" or "peek definition" to go directly to the class file
    1 point
  23. @AndZyk Attached, a quick and dirty job for Functions API, one for each style. $items = pages("template=basic-page"); style #1 $items = pages()->find("template=basic-page"); style #2 I don't know how style #1 works with (or should even work with) things like pages->count? I know style #2 could be pages()->count. Because of this, VSC will complain of duplicate keys since with the search and replace, we ended up with multiple pages(). (where we had pages->count; pages->find(), etc. :-). I also don't know about the WireArray stuff. I don't think those have functional api, no? They would have to be removed from these snippets. I haven't tested much. If you are able to test, I can upload to separate Gists, once cleaned up, thanks. vsc_pw_functional_api_style-1.json vsc_pw_functional_api_style-2.json
    1 point
  24. I can make a separate version for Functions API. Looks like a simple regex job Maybe not soon ?.
    1 point
  25. Yes, you can create your own formatter. Not sure about the learning curve though. Maybe start with an existing extension and build off that. I love notepad++ and use it daily....but not for coding. For text manipulations and a poor man's 'sticky notes', it works for me. But you can't even begin to compare it to VSC. They are two different beasts ?.
    1 point
  26. Thanks - that definitely narrows it down to Uikit then. One step closer ?
    1 point
  27. I see. I'm still on Reno, and get white text when LightWire is being used.
    1 point
  28. Hi, when applying CodeMirror in AOS, when viewing source the text is black on a dark background. Nothing I've tried seems to be able to override this (custom stylesheets etc). Any ideas?
    1 point
  29. I can't imagine how that's possible. You can always do <?php echo $var; ?> anywhere you want. Not saying you shouldn't go with: <?=$var?> but there shouldn't be anywhere you have to use it ?
    1 point
  30. I' not sure actually. I've just tried the <?= ... ?> and although they are highlighted, the editor shows a syntax error. <?...?> work OK. I'm not sure if there's an extension to handle the tags you want. I'd still urge you to give VSC a try ?and maybe even ditch those short tags; I've never liked them :-).
    1 point
  31. I had to handle this kind of validation in my AddImageUrls module, so the code there might be useful for anyone else needing to do the same: https://github.com/Toutouwai/AddImageUrls/blob/f67ebe9729fc54d629fe939be2f9d3e9c7f68c16/AddImageUrls.module#L118-L170
    1 point
  32. @Pixrael you should remove the link to that SC*M/SP*M site. Or do you want to support that kind of business? ?
    1 point
  33. As far as I can see, they can migrate ANYTHING to WordPress, probably one's old Z80 and/or MOS6510 code too ?
    1 point
  34. I have done both over the last 18 years or so. I think I'll try and do some kind of feature matrix and a bit of a write up on my experiences of going into Processwire so far in trying to achieve these things in Processwire.
    1 point
  35. Thanks to @matjazp, I've just pushed 1.0.6 which allows you to include the destination country ISO in the output if needed.
    1 point
  36. What version of Processwire are you running? I thought this had been fixed already? Maybe you can try with the latest version of Processwire dev branch?
    1 point
  37. ProcessWire & Vue.js — a Lovestory Introducing the all new ICF Conference Website The new ICF Conference Page — Fearless » What would happen if we were equipped to fearlessly face the daily challenges and live a life without fear? « This question is at the core of our next ICF Conference in 2019 in Zurich. Its also the question we set out to answer in terms of developing the new website; the all new ICF Conference website is our most advanced website in terms of technology, designed to take advantage of the latest web-technologies. Its a brand new design powered by a lean setup, using ProcessWire for easy content management and a slick frontend based on Vue.js, Quasar and a heavily customized Uikit theme. Technology-stack — From backend to frontend, technologies that are fun, easy and fast to develop with We built on the ICF Ladieslounge website as a solid foundation and took our learnings from building our last Conference Booklet PWA (Progressive Web App) and applied it to the new website. Some highlights of the new ICF Conference website: Completely decoupled backend and frontend Custom design based on Uikit frontend framework Changing of languages happens instantly, no page-reload required Easy content updates thanks to ProcessWire All data is transferred using a single request returning custom JSON » Continue reading on Medium And please don't forget to clap and share:
    1 point
  38. Yeah, Ben C was referring to a post about four or five about his. This one to be precise:
    1 point
×
×
  • Create New...