-
Posts
848 -
Joined
-
Last visited
-
Days Won
1
Everything posted by DaveP
-
Just off the top of my head you might be able to get round that by having a hidden field automatically populated with a kind of concatenated version of any multi word values - maybe Alice_One and Alice_Two. That way it might be possible to treat them as single word (kind of).
-
ckeditor - Remove wrapping <p> from <img> in source code
DaveP replied to CodeCoffeeCode's topic in Modules/Plugins
FWIW there is another option - Find/Replace Textformatter module. I have been using it for just this kind if thing recently and found it really useful. -
Storing Json Data on one Field vs slitting to Multiple Fields
DaveP replied to huseyin's topic in API & Templates
Based on nothing but gut feeling, the second. That's the way I did it last time I was importing JSON from somewhere, mainly because I was glad to be able to stop thinking about the horrible JSON object and concentrate on nice PW fields. If you were going to be really careful, some benchmarking might be in order, but I suspect there wouldn't be much in it, just what you're more comfortable dealing with. -
Oop, my bad. As you were.
-
I think some of your class declarations are invalid. (On mobile so copy/paste awkward.) The 'hover:xxxx' is CSS but not valid as a class name. Firefox is obvs more easy-going than others. Hope this makes sense.
-
Just a guess, but could this be a namespace issue? Have all the files involved got namespace declarations? (Including AIOM?)
- 1 reply
-
- 1
-
-
Pretty sure that's it, @Robin S. I always turn off formatting before any CRUD type operations via the API. Probably more in a cargo cult kind of a way than I should🙄.
-
@rick Thanks for that - I'll give it a try. I'm beginning to think that either I'm remembering how to interact with image fields incorrectly or my 'photo' field, which is set to contain 1 image ('photo' not 'photos') somehow isn't respecting that setting. And therefore that the error is unconnected to the new image field template setup.
-
The 'photo' field is all set up with a 'field-photo' template. Everything works in PW back end but setting values programmatically isn't having any. The code is like this. $page->of(false); $page->photo = 'https://example.com/img.jpg'; $page->save(); $page->photo->textfield = 'Some text'; $page->save(); $page->of(true); That's an abbreviated version.
-
I'm interacting with an external API to download external images, saving them and some related info, using the new image custom fields. This error appears when trying to save a text field programmatically. Error: Exception: Item 'title' set to ProcessWire\Pageimages is not an allowed type Are there any gotchas I'm not aware of?
-
Modyfikacja por roku i odziezy najwyzszej jakosci
DaveP replied to james smith's topic in General Support
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.) -
selector Per-word $selector for autocomplete search bar
DaveP replied to Eunico Cornelius's topic in API & Templates
Aaahh, I wasn't understanding correctly. Maybe something like this might be useful. -
selector Per-word $selector for autocomplete search bar
DaveP replied to Eunico Cornelius's topic in API & Templates
If I understand correctly, in your $selector, use body^=$q instead of body~=$q. (Note caret instead of tilde.) See https://processwire.com/api/selectors/#operators -
Is it possible to use HTML tags in log files and how?
DaveP replied to Juergen's topic in General Support
Would \n or \r\n work instead of <br>? -
i don't really know what the problem is - SSL or Jquery?
DaveP replied to dubiousa's topic in Getting Started
Not yet. Let's try some stuff first. There's something going on in .htaccess, because it redirects to www.vivid.black under some circumstances. You might try renaming .htaccess to htaccess.old or some such and replace it with a new copy of the default one in the PW download, see if that changes anything. -
i don't really know what the problem is - SSL or Jquery?
DaveP replied to dubiousa's topic in Getting Started
Welcome, dubiosa! Well, whatever you've got going on, it's very strange. If I visit the http URL you posted (with a full stop at the end (?)), I get the default Apache page. If I remove the full stop, it redirects to https and I get a certificate error. If I replace the full stop with a slash, I get an actual web page over https. Is the server a VPS? Is it managed or unmanaged? Is it shared hosting? As far as I can see, it's likely to be either a server misconfiguration (Apache etc.) or your .htaccess, or a bit of both. Tell us a bit more and we'll try to help. -
Very occasionally you'll come across a deprecated/removed PHP function in a very old module written for PHP 5.3 or 5.4 (what's the earliest version PW worked with years ago?) if you're now using, say, PHP 7.2. Even that kind of thing can be relatively easily Googled, or I'm sure someone on here could help with a specific problem of that kind.
-
Resizing image ($image->width(xxx)) inside function
DaveP replied to Hurme's topic in Getting Started
Ok, this should work $image = $child->images->first->width(500); $out .= '<img src="'.$image->url.'">'; See http://cheatsheet.processwire.com/files/image-properties-in-addition-to-those-in-file/image-width/ -
Resizing image ($image->width(xxx)) inside function
DaveP replied to Hurme's topic in Getting Started
Just a guess, but try $out .= '<img src="'.$image->width(500)->url.'">'; because I think your version is trying to change the width of the url. -
OMG! Senior moment.
-
This might help -
-
Know exactly what you mean! I had something similar a couple of years ago and did find a kinda solution, but was never happy with it. Just hope I remember about this next time the need arises.
-
...and if you need a break from reading, take a look at this if you haven't seen it already. It's a very old video that Ryan did for PW 2, but very much recognisable even now. It covers some of the content management aspects of the PW backend.
-
Module idea: index + search file-contents
DaveP replied to dragan's topic in Module/Plugin Development
Update re previous post Following on from a bit more testing, I have forked the Indexer module mentioned above and started a new thread...- 7 replies
-
- 3
-
-
- file-search
- uploads
-
(and 2 more)
Tagged with: