Leaderboard
Popular Content
Showing content with the highest reputation on 04/11/2018 in all areas
-
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; } } }9 points
-
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.)6 points
-
Please see the current version of this module here: https://modules.processwire.com/modules/rock-finder/5 points
-
That Field Values panel is huge I guess it's available for a while but I haven't seen it (probably along with many others) Here is a small tweak that could make such large tables easier to read - sticky table headers: .tracy-panel th { position: sticky; top: -13px; } The value -13px is probably a margin issue, and the inverted TH colors are there for better separation. Of course these sticky headers could be enabled separately for the different panels but I think they won't do any harm when applied globally but maybe I'm wrong. And Now for Something Completely Different Rollup panel on double-click on their titles: This is only quick devtools implementation but if you're interested I can roll down a better one5 points
-
@gmclelland - I think you're issues should be fixed in the latest version (thanks for PM help with this). @bernhard - I have modified the behavior of the large/small buttons in the Console panel to be fullscreen/halfscreen. Please take a look and let me know if you think that behavior suits your needs. I am ok with adding it to other panels as well if you think it works well, although obviously some panels would look pretty silly fullscreen As for the z-index issues - I think that's maybe an AOS conflict - @tpr was working on that yesterday. Please let me know if they persist with AOS disabled. Everyone else - while fixing the issue that @gmclelland was having, I make quite a few changes to the the Field List & Values section of the Request Info panel. It should now generally be even lighter and yet also show more depth of details. It also now shows unformatted and formatted values for each field. There is also a new Image Details column - displaying the thumbnails is optional (check config settings - you may want to disable if you have image fields with lots of images). Please let me know if you have any issues with the new version or ideas for improvements.4 points
-
Update 11/4/2018: Locking is implemented (though I haven't seen any hints that CODE uses it). Probably needs some serious testing. Editing has now to be enabled on a per-field basis (Details tab in file field configuration). Template context is supported. Added more inline comments to the code and did some cleanup.3 points
-
This will let you do what you want: http://modules.processwire.com/modules/fieldtype-runtime-markup/3 points
-
It just so happens that you can bootstrap processwire into scripts. I have used this several times and it is just one of the many awesome features. https://processwire.com/api/include/ Normally, I house specials scripts outside the template folder (like you have done) and just include processwire's index like: <?php include("/path/to/processwire/index.php"); ?>3 points
-
Hi @henri, Welcome to the forum. 1. Processwire itself is very fast. It must be some other reasons that cause the slow loading. We cannot help without further info. 2. After you add a field to the template in the backend, you have to add some PHP code to the template file. This is a good starting point to learn the basics of Processwire. Gideon3 points
-
Of course several unforseen issues came up but most of them are fixed: closing a rolled-up panel and re-activating it from the debug bar opened it in the rolled-up state. To fix, on closing a rolled-up panel "tracy-mode-rollup" class is removed so it opens up in normal state. setting width-height were tricky here and there but seems to be OK now with all the panels I've tried (Chrome only though). "ProcessWire Logs" panel has a link in h1, I've added pointer-events: none in rolled-up state to prevent accidental click on move resized panels were loaded cropped after page reload (if they were rolled up before reload). I've fixed it with a "beforeunload" event to allow Tracy save positions correctly keeping state after page reload: would be nice to have but I think this would be better handled in the core (Nette Tracy) Changes: style.css Lines at the bottom + added "user-select: none" on line 111 for h1 TracyDebugger.module Lines 823-867 - I haven't found a better place to add the JS part, I thought there's a js file that the module always loads but apparently there isn't. tracy-rollup.zip2 points
-
Just look at the modules code. It's just a few handful of code and a single hook.2 points
-
@adrian tyvm if anyone needs example of insert custom field before other form fields: wire()->addHookAfter('ProcessPageEdit::buildForm', function($event) { $pp = wire('pages')->get(wire('input')->get->id); $form = $event->return; $field = wire('modules')->get("InputfieldMarkup"); $field->label = 'TEST'; $field->value = $pp; $field2 = $form->get('title'); // Field to find and insert new field "before" it $form->insertBefore($field,$field2); });2 points
-
insertBefore or prepend https://processwire.com/api/ref/wirearray/insert-before/ https://processwire.com/api/ref/wirearray/prepend/2 points
-
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!)2 points
-
Yes it’s only for year 1. But a good deal if you’re intending on a paid plan anyway. ?2 points
-
If you're considering a paid plan, there's 90% off for the first year here https://www.idrive.com/idrive/signup/el/macworld90 That's not my affiliate link but probably MacWorlds2 points
-
That's trashing them (the tab title is unfortunately misleading there). The pages are put into trash and only deleted when you empty the trash.2 points
-
The error message reads like Memcached session handler is either unable to reach the server nfs01.cl2000.ams1.nl.leaseweb.net or to read from it. If you're on shared hosting, you should probably forward the error to your provider and let them take a look.2 points
-
As threatened in the Pub sub forum in the "What are you currently building?" thread, I've toyed around with Collabora CODE and built file editing capabilities for office documents (Libre-/OpenOffice formats and MS Office as well as a few really old file types) into a PW module. If you are running OwnCloud or NextCloud, you'll perhaps be familiar with the Collabora app for this purpose. LoolEditor Edit office files directly in ProcessWire Edit your docx, odt, pptx, xlsx or whatever office files you have stored in your file fields directly from ProcessWire's page editor. Upload, click the edit icon, make your changes and save. Can be enabled per field, even in template context. Currently supports opening and saving of office documents. Locking functionality is in development. See the README on GitHub for installation instructions. You should be reasonably experienced with configuring HTTPS and running docker images to get things set up quickly. Pull requests are welcome! Here is a short demonstration:1 point
-
Like you said, $page->inscr_nr is a text field, not a repeater, so output its value directly, removing "->title": $content .= $page->inscr_nr . '</p></td></tr>';1 point
-
Sure, I'll add to the next version. Sounds like a good idea - thanks! I think this looks awesome actually. I was kinda looking for something along these lines, but never really figured out the best approach. I went with the ESC to close all panels, but then there was no way to restore. I was going to add a Tab key option to work like tool panels in Adobe products, but you can't really make use of the tab key like that because it's needed for so many other things. I think what you have here looks like a great option for quickly getting a panel out of the way without closing it. Would appreciate some code whenever you get around to it - thanks!1 point
-
It's always good to sanitise and validate. You don't lose anything. The only things you don't sanitise are passwords (just validate) and usually, a submit button (just check if post sent). Regarding the radio buttons, you are using $sanitizer->option which is validating the options sent. Implicitly, you are sanitising here as well since you provide the array of sanitised values. Yes. Sanitise it too as necessary. But, these depend on what you are going to do with the values. General practice though is to sanitise at the earliest opportunity. There is also encoding of html entities if you are going to be echoing back input values. So, this... echo $sanitizer->entities($str);1 point
-
1 point
-
Great job @adrian! I'm just confirming that the update did get rid of the error I was seeing. I like the new enhancements and how the image is displayed. What do you think about the thumbnail linking to the original file?1 point
-
There are different possible approaches, but this should work: create a subdirectory in your web root for every domain, named exactly like the domain make sure ownership is correct add a rewrite rule in .htaccess before #12 that prepends the requested host name to the path: RewriteCond %{REQUEST_URI} ^/?\.well-known RewriteRule "(^|/)(.*)$" $1%{HTTP_HOST}/$2 [L] start letsencrypt with webroot option pointing to /path/to/pw/domain-in-question for every domain enjoy1 point
-
If you add the error line to https://github.com/processwire/processwire-issues/issues/408 Ryan will no doubt make short work of it.1 point
-
Worth watching entirely. Don't miss the fallback solution (5 steps). Firefox/Firefox Developer Edition has a grid inspector. https://www.mozilla.org/en-US/developer/css-grid/ https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout https://gridbyexample.com/ https://rachelandrew.co.uk/css/cheatsheets/grid-fallbacks https://cssgrid.io/ (there is also https://flexbox.io/ by the same author) https://cssgridgarden.com/ (already mentioned in the topic) And so on.1 point
-
Hello @adrian, I have implemented your fix and for the moment everthing seems to work fine. If I discover any issues I will post it. Thanks1 point
-
If your PW version is >=3.0.95 you could try the soundex search code in this thread. Not sure if the soundex algorithm can be of help in your case but maybe worth a try. Implementation is quite simple.1 point
-
There is an option in the field access tab "Make field value accessible from API even if not viewable" that would probably resolve that. Alternatively you can prevent the field appearing in ProcessUser with this hook: $wire->addHookAfter('ProcessPageEdit::buildFormContent', function(HookEvent $event) { if($this->process != 'ProcessUser') 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
-
1 point
-
FF 58? That's interesting! The "girls" said that the problem started about 10-14 days ago. Perhap the problem was introduced to FF with V 59? Doesn't matter. It also happens on CKE's own demo. https://ckeditor.com/ckeditor-4/1 point
-
Thanks for this module @bernhard , I am going to test it heavily today. In the project I built, similar to what you showed us, we are calling 30,000 pages to 100,000 pages per iteration (17 atm) and doing heavy aggregation on it to generate statistics and chart - a pain, hopefully fixed with your module. At this moment I am using this module quite modified for my need which add custom functions to the Page object by hooking it. I think that today I will re-write my hooks using your module. Feedback coming. Thanks again for the work and congratulation ?1 point
-
Hi, I guess I found a side effect of your last update (I suppose because of the hook). The "New" link now appear on front-end when pagefield is used in formbuilder. It's not that I don't want even if it's contradict module's name (!) (in fact, could help me), but the link doesn't work anyway. Give a strange url : /undefinedpage/add/?parent_id=1050&template_id=46&modal=1 For now, I will downgrade, because I need this functionality in admin. Thanks1 point
-
Hi Adrian, Just upgraded to the latest version and noticed an error in the "Request Info" panel: ErrorException: Trying to get property of non-object in /Users/glenn/websites/mysite/wwwroot/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php:643 Stack trace: #0 /Users/glenn/websites/mysite/wwwroot/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(643): Tracy\Bar->Tracy\{closure}(8, 'Trying to get p...', '/Users/glenn/we...', 643, Array) #1 /Users/glenn/websites/mysite/wwwroot/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(458): RequestInfoPanel->getFieldArray(Object(ProcessWire\Page), Object(ProcessWire\Field)) #2 /Users/glenn/websites/mysite/wwwroot/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-master/src/Tracy/Bar.php(159): RequestInfoPanel->getPanel() #3 /Users/glenn/websites/mysite/wwwroot/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-master/src/Tracy/Bar.php(108): Tracy\Bar->renderPanels() #4 /Users/glenn/websites/mysite/wwwroot/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-master/src/Tracy/Debugger.php(293): Tracy\Bar->render() #5 [internal function]: Tracy\Debugger::shutdownHandler() #6 {main} I tried refreshing the modules but it didn't make any difference. ProcessWire: 3.0.98 PHP: 7.1.12 Webserver: Apache/2.4.29 (Unix) MySQL: 5.7.10-log1 point
-
I'm quite sure you will Actually it's a VERY important part of my RockGrid module. This makes building Grids (or Datatables, or "Listers" how we in the PW world would call it) a breeze. You just throw a $pages->findObjects() call to the grid and let it do the rest (sorting, filtering, pagination etc). Another usecase where this can really be a lifesaver is all kinds of data exports, feed generation etc. - It makes a huge difference to load 10.000 pw pages compared to executing an SQL and a quick php foreach. I'm working on the module again because it was too limited for my needs. I think I will come up with a good solution the next days! (And proper docs)1 point
-
I am not sure if I would ever have a practical use for this myself (at least not in the foreseeable future), but I must say it's a pleasure to see this project seeing the light of day. Kudos. For me, it's always a treat to see what people come up with using PW. Goes to show you never can tell. PW really is "not just another CMS", but a framework as well. Hope I find some time taking a test-ride with your module very soon...1 point
-
His next post was definitely spam - links to shady site - he's blocked as a spammer now!1 point
-
I know. But the content editors are women in their end thirties and who am I to argue with them? I don't have a death wish I filed a bug report with CKE and it was closed with a note that it is FF issue. https://bugzilla.mozilla.org/show_bug.cgi?id=14529061 point
-
If you are not using TracyDebugger, then I urge you to install it then debug both variables, you will find your answer1 point
-
1 point
-
Now that I've looked at the Network inspector, I know why: it took 22 seconds to load all the 25.4MB of images here in Brazil in a 60 Mb/s connection.1 point
-
Very nice!! Loved your work, specially Fabricius logo and website. Great job!! The only criticism I can make is that sometime a click on an item took more time than expected and I had no visual clue to see if it was loading or not.1 point
-
Check out https://github.com/mrclay/minify But I don't know if it is worth the effort. For in the backend I wouldn't mind having multiple files loaded even if some of them have only one line.1 point
-
The value of the Inputfield is set from an user trough the module config page ? If yes (I dont know how your module work) , then imagine the following, in the getDefaultData() you have : protected static function getDefaultData() { return array( 'ml_myfield_data' => '' ); } In your getModuleConfigInputfields() : public static function getModuleConfigInputfields(array $data) { $data = array_merge(self::getDefaultData(), $data); // [...] $f = $modules->get("InputfieldCKEditor"); $f->attr('name', 'ml_myfield_data'); $f->value = $data['ml_myfield_data']; $f->useLanguages = true; // [...] } Then in module ready() (for testing purpose) you can return the right language : if($this->wire('languages')) { $userLanguage = $this->wire('user')->language; $lang = $userLanguage->isDefault() ? '' : "__$userLanguage->id"; } else { $lang = ''; } bd($this->data['ml_myfield_data'.$lang]); // debug with tracy After you change your language in your profile, it should return the right language.1 point
-
1 point
-
Have you tried to check the "Add DROP TABLE / VIEW / PROCEDURE..." Option when exporting from phpMyAdmin? EDIT: It is in your screenshot above under "Object Creation Options"1 point
-
1 point
-
That kind of inline editing has been on my radar for ages. Until now, all solutions were either incredibly complicated or died before reaching maturity (e.g. WebODF). CODE is going to be the final piece in so many puzzles1 point
-
Is your page unpublished? InputfieldPassword is set to required on unpublished pages regardless of what you might have chosen in the field settings - see here. Probably only @ryan could tell you why this is so. You can work around the issue with a hook in /site/ready.php: // You may need to modify "pass" to whatever your password field is named $wire->addHookBefore('Field(name=pass)::getInputfield', function(HookEvent $event) { $page = $event->arguments(0); $field = $event->object; // Do some test on $page and/or $field to identify the cases where the password field should not be required // Then... $field->required = false; });1 point