Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/13/2018 in all areas

  1. For the most part I've been working to wrap up a client project this week, running in ProcessWire of course. At this point I'm using markup regions exclusively on new projects, as they really add an element of fun while also simplifying development, at least in my case. Admittedly, when we first introduced markup regions, I thought they'd be a good alternative for new users (who might otherwise use direct output), and didn't think I'd be using them myself. I was wrong. After I started using them, quite awhile ago, I've found that I rarely want to use anything else. I enjoy using them, whether developing something new, or going back and modifying an existing site that's using markup regions. I'm curious if other people have also taking a liking to them? There have been some commits to the core this week, as well as some other not-yet-committed updates on the dev branch, but not enough to warrant a version bump today. So we'll save the 3.0.99 version for next week. I have been getting lots of good reports on the current PW master version, very few issue reports, and feel we've got a really good solid and stable version on our master branch right now. Just in case there's anyone that's not yet using it, I recommend the upgrade. Thanks for reading, hope you all have a great weekend.
    10 points
  2. An Images field allows you to: Rename images by clicking the filename in the edit panel or in list view. Replace images, keeping metadata and filename (when possible) by dropping a new image on the thumbnail in the edit panel. Introduced here. But neither of these things is possible in File fields, which prompted this module. The way that files are renamed or replaced in this module is not as slick as in the Images field but it gets the job done. The most time-consuming part was dealing with the UI differences of the core admin themes. @tpr, gives me even more respect for the work that must go into AdminOnSteroids. Most of the code to support the rename/replace features is already present in InputfieldFile - there is just no UI for it currently. So hopefully that means these features will be offered in the core soon and this module can become obsolete. Files Rename Replace Allows files to be renamed or replaced in Page Edit. Usage Install the Files Rename Replace module. If you want to limit the module to certain roles only, select the roles in the module config. If no roles are selected then any role may rename/replace files. In Page Edit, click "Rename/Replace" for a file... Rename Use the text input to edit the existing name (excluding file extension). Replace Use the "Replace with" select to choose a replacement file from the same field. On page save the file will be replaced with the file you selected. Metadata (description, tags) will be retained, and the filename also if the file extensions are the same. Tip: newly uploaded files will appear in the "Replace with" select after the page has been saved. https://github.com/Toutouwai/FilesRenameReplace http://modules.processwire.com/modules/files-rename-replace/
    9 points
  3. This is a lightweight alternative to other newsletter & newsletter-subscription modules. You can find the Module in the Modules directory and on Github It can subscribe, update, unsubscribe & delete a user in a list in Mailchimp with MailChimp API 3.0. It does not provide any forms or validation, so you can feel free to use your own. To protect your users, it does not save any user data in logs or sends them to an admin. This module fits your needs if you... ...use Mailchimp as your newsletter / email-automation tool ...want to let users subscribe to your newsletter on your website ...want to use your own form, validation and messages (with or without the wire forms) ...don't want any personal user data saved in any way in your ProcessWire environment (cf. EU data regulation terms) ...like to subscribe, update, unsubscribe or delete users to/from different lists ...like the Mailchimp UI for creating / sending / reviewing email campaigns *I have only tested it with PHP 7.x so far, so use on owners risk EDIT: Since 0.0.4, instructions and changelog can be found in the README only. You can find it here ? If you have questions or like to contribute, just post a reply or create an issue or pr on github, thanks!
    7 points
  4. Sorry to say, whenever I see the vanilla JS alternatives to jQuery, it reminds me why I still use jQuery
    7 points
  5. I've been searching for a CSS-only solution for a while to reveal a scroll-to-top link only after scrolling down the page, but no luck. Today I figured out that it's possible with position: sticky. The beauty of this is that you don't need to check the scroll position in a scroll event (+ in document ready, window resize), which makes it really lightweight. Update: added "html { scroll-behavior: smooth; }" and now there's animated scroll (Firefox 58+, Chrome 63+). It seems that Js is not required anymore to this feature. CodePen demo
    4 points
  6. Each year we cycle 1000km with our company to fight against cancer. To participate with 4 teams we have to collect 20.000 euros. Our graphic designers made some goodies en we also organise a spaghetti fundraiser. To help the sales we decided to make a webshop with our webteam. And of course we used our favourite CMS for the job! ? https://shop.typografics.be/ At this moment we raised more than 20.000 euros, so all our teams can participate. This is a very special project for us, unfortunately one of our colleagues has been diagnosed with cancer and currently is fighting against this terrible disease. Premium PW modules used in this project: PadLoper FormBuilder ProFields Variations With a few hooks here and there we managed to make it work. To handle the payments we made use of Mollie, we created our own payment module and will opensource this soon. You can read more about this project in our blog (in dutch) Unfortunately we're currently only shipping to Belgium We’re already brainstorming to make a 2.0 version of this webshop, so all your feedback is more than welcome.
    3 points
  7. The module looks for a GET parameter register. When this is set to 1, it renders the login form. So what you could do is in the temnplate where you render the login form // set GET parameter register to 1 $input->get->register = 1; // render the form $content = $modules->get('LoginRegister')->execute(); I just tried it and it seems to work.
    3 points
  8. Hi, With the introduction of GDPR regulations, many of our clients with "webuser" systems we've developed need a way to email users that haven't logged-in in a while (18 months seems to be the standard) to ask them if they still want their user account. For most of the systems we've developed, we've added a field to the user template which records the time when the user logs in, so we'll be able to develop this functionality. It got me thinking, would this be a welcome addition to the core, accessed in a similar way to created/modified dates e.g. $user->lastlogin? Were it to be implemented, it would be useful to be able to 'silently login' if using $session->login($username, $pass) or $session->forceLogin($username), in the same way you can bypass save hooks by passing in an option to $pages->save(). Cheers, Chris - NB Communication
    2 points
  9. I get that, but if everyone is using their own helper libraries and different frameworks, you lose the great jQuery ecosystem and all the plugins and libraries built on top of it. You could end up having to include a bunch of code from different libraries that are doing the same thing in order to use the existing solutions you want. That feels like a step backward to me. I don't see why jQuery can't just be retooled so that it's using newer, faster technology under the hood, with the same compact, standardized api on the front end. Maybe have a legacy jQuery and a new, slimmer jQuery for those that don't need old browser support. Regarding jQuery and more advanced JS applications, I don't think jQuery should be thought of as competing against vue or react. It's at a lower level in the stack. It doesn't impose structure on your application, but that doesn't mean it prevents you from creating your own structure. Disclaimer: These are just my feelings as a developer who is still trying to build my applications largely server-side, where my ajax calls usually return blocks of html encoded within JSON instead of pure data structures. This keeps all rendering and business logic server side in order to keep the application code simple and DRY. Not sure if I really know enough about what I'm talking about when it comes to the new client-side development paradigm. I feel like both are reasonable approaches to development (depending on the application's requirements). It's when you don't choose one or the other that things really get messy and WET.
    2 points
  10. Phew... This was quite hard but finally I made progress. Please see the dev branch if you want to play around @flydev : https://gitlab.com/baumrock/RockSqlFinder/tree/dev#notes (other parts of the readme are outdated meanwhile, It's just some notes for myself and old examples..., sorry no more time today). This is an example query with a join. This is necessary for pagefields when you want to get not only the page id's but also the related page's fields information like "title": Next step is to make CONCAT operations possible so that the join will return a concatenated string of ids and titles (miau, cat ..., mimimimi). This should also make aggregations like sum() possible (see here: https://gitlab.com/baumrock/RockSqlFinder/tree/dev#notes -> not much change needed for the resulting sql). The new version of the module is completely recursive, so I hope (haha...) that support for image fields with description (in this case it's not a related table but on the same table like the imagefield) easy. We will see... PS: Actually I just realized that defining the field "cats" is stupid when we define a join named 'cats'. Because I'm removing this field later anyhow... need to change this. You see there will be some more changes in the future, sorry...
    2 points
  11. you can just put a get variable ?register=1 on the request and it will show the registration form..
    2 points
  12. thanks for the headsup glad you found it! I'm right now working on a complete rewrite of the module. The syntax will change a little bit but be a lot more flexible. I'm working on a recursive version that should make it possible to easily query pages that are referenced by pagefields. This is a huge timesaver when working with mysql because this joins can really be a tedious task. This setup should also make it possible to do easy aggregations via custom SQL statements. That's why I think I will not need your aggregation functions for $pages api Hmm... Thinking about it... Maybe this could be helpful in some situations. Maybe you want to share it in the dev board with all of us? I hope I can push an update this week.
    2 points
  13. @Robin S , I haven't forgotten .... just been flat out recently. As you can see, I've programmed the side mouse buttons accordingly to my own usage patterns. The commands you see are for PHP Storm. Most/All of them are commands i use for debugging. I also have other profiles for different programs / IDEs as you can see on the top menu (Visual Studio, Diablo3 etc) Another interesting thing is there is a right mouse button you can click (G-Shift) which you can press to get an alternative set of comma. I've grouped out IDE editor commands here seperately. Also, it lets you have 3 different modes according to Colour which you can customise. You can see above that I'm currently in the default mode of Purple. There's a button at the top of the mouse that lets you cycle through other modes. Following picture shows the commands for the Red mode. I've put in some Web Browser commands in the Red mode for example. So it's a bit of work to program the commands you use and lay it out the way that's useful to you. I am happy to provide the profiles if anyone needs it, save you hours! The huge advantage of going through this process is you can just learn 1/2 set of layouts and you can use it on multiple IDEs , enviroments. My Visual Studio layout is almost identical to PHPStorm layout (bar some unique commands) so I know exactly where the StepOver or StepThrough commands are exactly. Perhaps overkill if you just use 1 IDE or program in 1 environment but if you're jumping around, then I don't know of a better solution than this. The only issue you might have if you're intrigued is sourcing the mouse. I think I've seen some go on sale on eBay still ...
    2 points
  14. I had an issue on local sites recently where communication with the Google Maps geocoder was failing due to an SSL error. The error message was a little different than what you are seeing, but it might be worth a shot. Have a read of this article: http://www.bigsoft.co.uk/blog/index.php/2017/04/29/file-get-contents-ssl-operation-failed-with-code-1-ssl3-get-server-certificate-certificate-verify-failed And follow the steps: Download the cacert.pem file to some suitable permanent location Edit php.ini to set the path to the downloaded file, openssl.cafile=/path/to/cacert.pem Restart Apache
    2 points
  15. I just relaunched my portfolio website. It's my first ajax driven website using ProcessWire as a CMS. Its a showcase of some of my work as well as a digital playground to improve my coding skills. If you encounter any bugs or have feedback, feel free to share janploch.de
    2 points
  16. I see now, but I think the & in the selector would be misleading. As for the array syntax I can say nothing as I haven't used it so far.
    1 point
  17. It is at the top of: /wire/core/ProcessWire.php Are you sure? Maybe you overlooked something? As far as I know, nothing has changed in PW which should make it fail if it worked previously. In the forums, there are various discussions on serving PW from a subdirectory, maybe this one is a good starting point: https://processwire.com/talk/topic/15520-processwire-install-on-a-sub-directory/
    1 point
  18. Maybe that page in the trash has a template assigned which no longer exists. Try to edit it, set it to any tpl that exists, save - and then delete. Or you could try to delete it via API:
    1 point
  19. what does this say when you put it before everything else? var_dump($modules->isInstalled('FormTemplateProcessor'));
    1 point
  20. It works with asmSelect type only (atm). Install AdminOnSteroids module, enable AsmTweaks at the top, then scroll down to its config section (or click the "cog" icon in the AsmTweaks block's bottom-right corner to jump there). Here check "Add limit to AsmSelect" and save AOS. Finally, in your field's Input tab set the max number in the "Max limit of items" input field . https://github.com/rolandtoth/AdminOnSteroids/wiki/AsmTweaks
    1 point
  21. @pmarkii can take it over if you want, and i do have an updated version as described above.
    1 point
  22. Module updated to v0.1.3. The workflow for replacing files is now reversed, because it's more intuitive that way. Readme and screencast updated.
    1 point
  23. Imo the overall backlash on jQuery is less about jQuery vs. vanilla, but jQuery vs. less messy abstractions. For ajax there's no need for jQuery anymore with other libraries taking their turn being just as good without being bundled with all the other jQuery stuff. And for DOM manipulations I feel twofold: For simple stuff jQuery is hardly shorter/easier to write than vanilla js + 2 or 3 small helper libraries (e.g. for event delegation) and for everything more advanced jQuery code most of the time is just a mess of one-off manipulations and implementation details mixed with a bunch of event callbacks. These are the places where I feel react / vue / ember or for a really vanilla feel svelte are far better equipped.
    1 point
  24. I just set this up on my dev install 3.0.96 with your code from above and it works. Only thing I changed is $form->parent... So it is hard to say what goes wrong on your end without seeing the complete template code. EDIT: what does this say? $form = $modules->get('FormTemplateProcessor'); var_dump($form); And then right before your echo? var_dump($form); echo $form->render();
    1 point
  25. @gebeer Thank you - I was trying something like this <?php $input->setUrlSegment(1, "register=1");?> But this didn't work :-( Many greets!
    1 point
  26. It looks like the following works: RewriteBase / # RewriteBase /pw/ # RewriteBase /~user/ With this configuration, the 200 OK errors do not display and the PW admin page tree renders properly.
    1 point
  27. The reason in terms of the code is that a password inputfield is forced to display uncollapsed on unpublished pages because of this part of InputfieldPassword. There is no way to override this collapse status with a hook. As for the reason "why?", I can only speculate that Ryan sees the password field as a special case that is unlike other fields, and does not expect it to be used apart from the single built-in usage in the user template. Did you try the hook I suggested in my previous post? I'm not clear on whether you are using the password field a second time in the user template or in some other template besides the user template. If it's the latter and you are not editing the page via ProcessUser (i.e. not under the Access > Users section of admin) then you would modify the early return test to check for template instead. $wire->addHookAfter('ProcessPageEdit::buildFormContent', function(HookEvent $event) { $page = $this->process->getPage(); if($page->template != 'your_template') return; $form = $event->return; $pass = $form->getChildByName('pass'); // Assuming your password field is named "pass" if($pass) $form->remove($pass); $event->return = $form; });
    1 point
  28. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
    1 point
  29. https://github.com/nefe/You-Dont-Need-jQuery
    1 point
  30. @PWaddict Here is very useful site http://youmightnotneedjquery.com/ that you want to visit when you try to convert jQuery to vanilla.
    1 point
  31. Hi, sorry for not being up to date, I'm working with Magento now. @msncom I don't think it's possible. I am happy to pass ownership of this module to someone who will be able to maintain it. In community we trust
    1 point
  32. yes, if you need to hold those sorts of things, especially images, you should stick with real fields. The main advantages of using a settings module could be summed up as: (1) fast an easy to add a settings page (since you can reuse the same json file) and don't need to setup fields (2) dedicated edit screen with no tabs as on the edit screen (no children, settings etc), no delete (3) settings stored as JSON in 1 table/field (module config) (4) human readable editing url, no url param (5) since it is a process module, easy to link to the settings page directly in the admin menus more discussions on the Settings Factory topic..
    1 point
  33. just merged @gebeer's changes to support multiple renderers in separate files and he also added a bootstrap renderer thank you!
    1 point
  34. ProcessWire supports that out of the box. See here for a getting started documentation.
    1 point
  35. Sorry, I don't get it. You three different layouts for PTE, so far so good. Now you wanna do what? The read more link to a different page should point to a different template? Why not? For that URL the detail page template is used, isn't it?
    1 point
  36. Nice! Very interested in your padloper/mollie combination looking forward to your open sourcing of the payment module you built.
    1 point
  37. Have you tried to do $page->of(false) before you add the image? $page->of(false); $page->filepreviews->add($img); $success = $page->save(); EDIT: this would explain why the first did not get added but the follwing did. Because of() was only set to false after adding the first image
    1 point
  38. Also it maybe an improvement from the other side, to serve your users some filter-lists (dropdown selects) of the products, additionally to the fulltext search field? Here you can see an example with architects in an archive, (realized with url-segements), that only serves all matching archive albums. (could be also only products) Whereas the fulltext search serves also matches in the blog or on pages with matches in different bodytext parts. The fulltext uses %= operator, that also allows to match small text snippets like BRT. (And yes, uses the pipe as OR selector!)
    1 point
  39. Sorry, no idea. Only situation where I know that it is slow is when it loads pages because of closures. Do you have the current version? Is this check available in your module? https://gitlab.com/baumrock/RockSqlFinder/commit/17464b0397ed5f3d62bc86177d0c2395f33b5d9e Thanks, no need at the moment
    1 point
  40. 1. This part... // 4. // Split search phrase // If nothing above matches, try each word separatly if( !count($matches) ) { $q_separate = preg_replace('/\PL/u', ' ', $q); // "Remove" everything but letters $q_separate = preg_split('/\s+/', $q_separate); foreach ($q_separate as $q_word) { if ( $q_word != '' && strlen($q_word) > 4 ) { $append_products_separate = $pages->find("title|headline|summary~=$q_word, template=product, limit=50"); $matches->append($append_products_separate); } } } ...is needlessly inefficient. You don't need to do separate database queries per word here - you can use the pipe as an OR condition between words. So basically replace spaces with pipes in your search phrase and match against title|headline|summary. 2. Consider using the %= operator so you can match part words. So a search for "toast" will match "toaster". 3. If you don't have a huge number of products then maybe a fuzzy search using Levenshtein distance could be a possibility, for product title at least. I did a quick test against 196 country names (239 words) and it was reasonably fast. $q = 'jermany'; $countries = $pages->find("template=country"); $matches = new PageArray(); foreach($countries as $country) { $words = explode(' ', strtolower($country->title)); foreach($words as $word) { // Adjust max Levenshtein distance depending on how fuzzy you want the search if(levenshtein($q, strtolower($word)) < 2) { $matches->add($country); break; } } }
    1 point
  41. Few random thoughts... Log all searches (you probably already do). This works $log->save('search',"Query = '$q' Results = ($results_count) $pages_found"); gives something like 2018-03-12 16:19:08 guest https://example.com/search/?q=taxi Query = 'taxi' Results = (3) 1170|1073|1693 2018-03-13 11:22:27 guest https://example.com/search/?q=9001 Query = '9001' Results = (1) 1021 This is valuable because it shows you what you are up against! Consider incorporating stemming (if you are working in English, at least). The best-known algo is the Porter stemming algorithm. There are PHP implementations on GitHub etc. What you could look at is for each product, hook on product save and have a back-end field programmatically populated with stemmed versions of Product Title etc., then stem search words and build that into your selectors. Also consider a back-end 'search keywords' type field, and if there's a glaring regular user mis-spelling just add that manually. This doesn't scale all that well, but can help with a quick fix. (I built a search for a fishing tackle shop site many years ago - pre-PW - and nearly as many searchers spelt 'Daiwa' as 'Diawa' as those who got it right. Easy quick fix.)
    1 point
  42. The problem is that those issues are a hard problem to deal with, which is why there are dedicated software solutions out there just dealing with search. Especially the spelling mistakes are really difficult to come by. Also generalised solutions mean this is a issue of the database, so MySQL for processwire, but in your case (small scale) you could also try to improve things from the PHP side.
    1 point
  43. I've been using the Auto-Open Markdown Preview extension. Works a treat. Only problem I have with it is that it does not auto-close the preview when the markdown file is closed.
    1 point
  44. If anybody of you like me totally missed the markdown preview of vscode just click the preview icon on the top right:
    1 point
  45. Adds a class="external" and a rel="nofollow" to every external link by default. Optionally adds a rel="noopener", a rel="noreferrer" and a target="_blank". Note: This module is based on TextformatterMarkExternalLinks and some improvements of @teppo that were never implemented due to module's author inactivity. Download TextformatterOptimizeExternalLinks Requirements ProcessWire 3.x Changelog 1.0.0 (3 April 2018) Initial release
    1 point
  46. hi @Martin Muzatko i would recommend you read the docs about hooks carefully: https://processwire.com/api/hooks (especially here: https://processwire.com/api/hooks/#add_new_method ) to your problem: try this: public function getMessagesBySender($event) { $user = $event->object; $sender = $event->arguments[0]; $event->return = $user->getMessages()->find('sender='.$sender); } you could also modify your getMessages method to take an argument as selector and then use it like this: $user->getMessages("sender=$user"); // additional tip: double quotes makes it easier to read sometimes ;) regarding the "event system": $event in the hooks is the hookevent object. you could call it whatever you want, but as it's called $event everywhere in PW it's good to stay with this naming. the object is needed by PW and it's hook system so you cannot just "return" from inside the method. or to be more clear: you can just return but then it will not change anything. thats the way how you can do early exits: $wire->addHookAfter('Pages::added', function($myHookEvent) { $page = $myHookEvent->arguments(0); if($page->template != 'mytemplate') return; // example of early exit [...] } here i named $event differently just as a showcase. the $event->return property holds the "value" of the hooked method. this can be different things, for example a PageArray if you hook a page find operation or a simple string if you hook a field's value. This value is only one thing that is needed by processwire to fully execute the request. For example there is also the $event->replace property that would tell PW to completely replace the hooked method if it was set to TRUE - so pw would not call the original method after the hook was executed (this only works on before-hooks, of course). https://processwire.com/api/hooks/#replace_method hope this makes sense for you. i would also recommend using tracy debugger - it's a lot more powerful and easier to read than var_dump
    1 point
  47. i really like uikit framework and it has a nice looking pagination component: http://getuikit.com/docs/pagination.html creating the pager markup is a little bit tricky and i've only managed it with a little jquery hack. the problem is that the "active" item needs a <span> without an <a> and that's not possible with the built in renderPager() to save anybody needing uikit pager some time, here are the options: <?php echo $items->renderPager(array( 'numPageLinks' => 5, 'listMarkup' => "<ul class='uk-pagination'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>", 'nextItemLabel' => '<i class="uk-icon-angle-double-right"></i>', 'previousItemLabel' => '<i class="uk-icon-angle-double-left"></i>', 'separatorItemLabel' => '<span>...</span>', 'currentItemClass' => 'uk-active', )); and then you need this line of jquery to remove the <a> from the active item: $('li.uk-active > a > span').unwrap(); or do you guys have any better solutions for this? happy paginating
    1 point
  48. I suggest not extending the User class, and instead plugin to it with a module class UserExtended extends WireData implements Module { public static function getModuleInfo() { /* return your array here */ } public function init() { $this->addHook('User::sendThankYou', $this, 'sendThankYou'); public function sendThankYou($event) { /* do something */ } } The above would add a sendThankYou method to all User instances. Your sendThankYou method can gain access to the $user the method was called on like this: $user = $event->object; Your sendThankYou method can also have one or more arguments if you want it to: $arg = $event->arguments[0]; If you want your sendThankYou method to return a value, do it like this: $event->return = 'value you want to return'; Looks like Antti beat me to it.
    1 point
×
×
  • Create New...