Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/23/2019 in all areas

  1. 3 points
    From $config->pagefileSecure https://processwire.com/api/ref/config/ - When used, files in /site/assets/files/ will be protected with the same access as the page. Routines files through a passthrough script. I haven't used this yet, but there might be a performance hit? I'm not sure how much though? From here Wanze writes:
  2. 3 points
    You can assign your own API variables easily: // MyModule.module.php class foo { public function bar() { return 'works!'; } } class MyModule extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'MyModule', 'version' => '0.0.1', 'summary' => '...', 'autoload' => true, ]; } public function init() { $this->wire->set('foo', new foo()); } } You could also just save this instance to $config->foo $this->wire->config->foo = new foo();
  3. 3 points
    Thanks for sharing this, EyeDentify โ€“ nice and simple ๐Ÿ™‚ Just a little note before folks go implementing IP logging: IP addresses are considered personal data, and as such you should keep GDPR (and similar legislations) in mind. Here's SE question that covers the details related to logging IP addresses: https://law.stackexchange.com/questions/28603/how-to-satisfy-gdprs-consent-requirement-for-ip-logging. (The general consensus seems to be that you don't need to ask for permission before logging IP addresses, but there are other requirements you do need to keep in mind.)
  4. 2 points
    just a short update on this - i am stresstesting the PW way and i'm on the way yust with simple pages for now and see what comes up the road. made a crude script to get dummy data and created around 88k pages (DB are now 35MB) in very fast time on shared hosting...just for example to create 48 testrecords for every day (17260 pages - 2 records per hour) the scripts runs on in about 80 seconds...just for others that are search on create dummy content in a quick and dirty way i let my code here (if there are better ways - at least as a bad example..;) So far next things are to create a script that runs to build the averages of month, year for long term stats and then i will try how reporting and visualisation in an easy graph - works together with a DB that have around 90000 pages with just some integers and floats. I would first try how an easy to use chart library would work (https://gionkunz.github.io/chartist-js/index.html) Since this tools all use JSON data i think i could cache or better prepare this JSON strings for the charts and see how fast it performs...i'll report again. But this is an interesting experiment so far - i could choose how i spend my freetime in two really different worlds ->work on the backend with PW or solder and glue some things together on the hardware parts...before this project i was captured only on the web...;)
  5. 2 points
    As always I work this out after 30 mins of trying, but always 2 mins after posting on a forum ๐Ÿ˜› It was because the field type must be float. Funnily enough it works fine if it's Text, until you hit a negative number. I will leave this up for anyone who makes the same mistake as me.
  6. 2 points
    I created an issue for what I specified above. https://github.com/processwire/processwire-issues/issues/933
  7. 1 point
    WHY? I've started building this module because the existing solutions by @kongondo and @kixe (https://modules.processwire.com/modules/fieldtype-runtime-markup/ and https://github.com/kixe/FieldtypeMarkup) did not exactly fit my needs. Actually this module is aimed to be a base module that can easily be extended by other modules. It takes care of the heavy lifting that has to be done when working with custom fieldtypes in ProcessWire (injecting scripts and styles, handling JS events, doing translations). See RockTabulator as an example. I'm quite sure more will follow (eg ChartJS)... WHAT? This module helps you injecting ANY php/html/js/css into any PW backend form (either on a page or in custom process modules). It also comes with a sandbox process module that helps you setup your fields and provides handy shortcuts that integrate with TracyDebugger and your IDE: WHERE ...to get it? At the moment the module is released as early alpha and available only on github: https://github.com/BernhardBaumrock/RockMarkup2 If you have any questions or ideas please let me know ๐Ÿ™‚ PS: This module shows how easy it is to extend this module for your very own needs. All you need to do is providing the module's info arrays and then overwrite any methods that you have to modify (eg the InputField's render() method): https://github.com/BernhardBaumrock/RockMarkupExtensionExample
  8. 1 point
    A simple module to enable easy navigation between the public and the admin side of the site. After installation a green bar will appear to the upper side of the screen, containing a few navigation elements and displaying the PW version number. Heavily inspired by @apeisa's great AdminBar (Thanks!). I needed a bit simpler tool for my projects and as a result, this was made. Available on GitHub .
  9. 1 point
    Well... the proper way would be to develop a fieldtype for that. Hacking this together with RockMarkup should be quite easy though: Just add a hidden inputfield for that purpose and populate it via JS whenever you update the value of the RockMarkup field. But you need to be careful with that approach because the value transmitted can be manipulated easily via browser devtools if you don't do server side validation!
  10. 1 point
    This is so awesome. Thank you @bernhard. Testing some things right now
  11. 1 point
    Thx teppo, please leave it as is ๐Ÿ™‚ RockMarkup was released here:
  12. 1 point
    If you're interested in ironing this quirk out as well, here's one possible solution: https://www.media-division.com/correct-name-capitalization-in-php/ ๐Ÿ™‚
  13. 1 point
    $count_arr = []; foreach($page->my_repeater as $rep) { $name_normalized = ucwords(strtolower($rep->lastname . " " . $rep->firstname)); $count_arr[$name_normalized]++; } arsort($count_arr, \SORT_NUMERIC); $leaders = array_slice($count_arr, 0, 5); The caveats are names with prefixes, like Scottish McSomething, which will end up being Mcsomething, and that there's no sorting among names with equal vote count.
  14. 1 point
    Does the module need to read data back from the external database and display it in an interface for editing, or is PW only used for creating new data and inserting it into the database? Because if it's the latter you could still use Page Edit as the interface for data creation. You'd use a saveReady hook to get, prep and insert the data from the page into the external database, then clear out the page ready for new data. Maybe you'd add an extra submit button to Page Edit ("Send to database") so that the normal save buttons can be used to temporarily save data locally and only the "Send" button finally inserts and clears the data when the user is ready.
  15. 1 point
    Okay, after more investigating I can only reproduce this on image fields inside a repeater that have been set to "Vertical list (verbose)". To be clear it doesn't happen on normal image fields, only those inside a repeater.
  16. 1 point
    Hello folks, Your voice can also be heard: https://hacks.mozilla.org/2019/07/mdn-web-developer-designer-survey/ "The survey results will be published on MDN Web Docs (MDN) as an annual report. In addition, weโ€™ll include a prioritized list of needs, with an analysis of priorities by geographic region."
  17. 1 point
    Hi @MilenKo, you could try with an hook in ready.php. In this example Pages:saveReady is called right before the page is saved, so this can be used to fill some fields right before save will be executed. Assumption is that this is triggered when you are saving the page from within the Admin area. $wire->addHookBefore('Pages::saveReady', function($event) { $page = $event->arguments(0); if($page->hasField('date_created')) { $page->date_created = time(); } $event->arguments(0, $page); }); I quickly wrote it in the browser w/o testing Please note, this is more a date_modified as it will be overwritten at the next save, but you can easily make it a "true" date_created, with something like that: if(empty($page->date_created)) $page->date_created = time(); Sorry, of course I thought Linux-wise ... as you have a Windows server when you have sometime have look if php locales are installed.
  18. 1 point
    Hey Bernhard! Just a heads-up that I've moved this older RockMarkup thread to the Module/Plugin Development area. Please let me know if you'd rather prefer to have it merged with the module thread โ€“ though if we merge it, posts here will probably show up before the initial post in that thread, so it may look a bit weird ๐Ÿ™‚
  19. 1 point
    Why not use pages and proper Fieldtype fields to store the data? Seems like it would be much easier, and anything out-of-the-ordinary that you want to show within your Process module you could show within Page Edit by hooking the render of a markup inputfield, or by using one of the runtime field modules from kongondo, bernhard, kixe, or me.
  20. 1 point
    Well, had to do this now for including a privacy policy link in a formbuilder label ๐Ÿ™‚ $wire->addHookAfter("InputfieldCheckbox::render",function($event){ $field = $event->object; $output = $event->return; $policyUrl = $this->pages->get("name=privacy-policy")->url; if($field->name == "privacy_policy"){ $output = str_replace("privacy policy","<a href='{$policyUrl}'>privacy policy</a>", $output); } $event->return = $output; });
  21. 1 point
    I always use kind of this: <?php echo 'bla bla'.(($page->bla) ? $page->bla : '').' lorem'; ?>
ร—
ร—
  • Create New...