Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


BillH last won the day on February 23

BillH had the most liked content!

Community Reputation

66 Excellent

About BillH

  • Rank
    Sr. Member
  • Birthday 03/06/1962

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    London, UK

Recent Profile Visitors

1,332 profile views
  1. I think that sorting by path simply isn't available using selectors. What are you trying to achieve? If it's to get the results into the same order as in the admin (which of course it may not be!), you probably want "sort=sort" (see "How to force pages to sort by their admin order with $pages->find()" on https://processwire.com/docs/selectors/).
  2. I wouldn't think there'd be an issue with different usernames - though I could be wrong. An error with accessing the database does sound like the right sort of thing, but I'd expect the consequences to be more wide-ranging and the errors to recur. My guess is that these errors were caused by something else. Have you turned on debugging in config.php ($config->debug=true;) and is anything interesting returned? And are you using the same version of PHP on both local and live servers?
  3. Have you tried checking the logs? If not, I'd suggest looking at Setup > Logs (or going directly to the log files at Site > Assets > Logs). If you can't identify anything, it might be worth posting an excerpt here.
  4. Take a look at the "Formatted value" section of the "Details" tab for your Icon field. You can see that the data can be returned in various forms. So, depending on your settings and the number of images, $icon->modified could return the modified value from an image – but it's not a modified value for the field itself. If you want to set a value for modified, you need to set it for a particular image. Note that if in your code you set output formatting to off (https://cheatsheet.processwire.com/page/built-in-methods-reference/page-setoutputformatting-true-false/) you will always get an array. And it will avoid trouble when setting values. So in your code I'd suggest: ... foreach($pp as $p) { $p->of(false); ...
  5. Your code is trying to set a modified time for the field, but you need to set it for each file contained in the field. So replace: $p->icon->set("modified",time()); with foreach($p->icon as $icon) { $icon->set("modified", time()); }
  6. Have you tried following the instructions at https://processwire.com/modules/process-menu-builder/how-to-use-menu-builder/#how-to-use-menu-builder? They're quite a long way down the page, so perhaps you missed them. You'll also find them in the README.md file of the module. And you might want to look at the support thread in the forums:
  7. Welcome to the forums! If you don't want to use inline CSS, would you be happy with including the CSS in the template file's head section? Something along the lines of: <style>.hero{background: url(<?=$page->hero_image->url?>) no-repeat;}</style> Or you could build the style line in a separate PHP file and include the file. I may be missing something, but I'm not sure that placing the PHP getting the image URL in a linked CSS file would be more scalable or cleaner than placing it in an included PHP file. And you could avoid having to wrestle with htaccess!
  8. Thanks @Robin S, useful to know.
  9. There's a really useful page https://stackoverflow.com/tags/timezone/info - though it'll make you realise you're opening something of a can of worms! I think, but I'm definitely not sure, that PHP uses the IANA/Olson Time Zone Database (linked on the above page). However, even if it does, I don't know how up to date PHPs list of time zones is. The Geolite2 database from MaxMind, at https://dev.maxmind.com/geoip/geoip2/geolite2/, is free and gives IANA time zone codes. This is another option: https://www.ip2location.com/free/olson-timezone. And there may well be quite a few other such sources out there. I don't know of any ready-made tool, but that doesn't mean there isn't one!
  10. Pleased it worked 🙂 Whether you set output formatting inside or outside the loop shouldn't affect the issue – though inside would waste a few processor cycles! I've done some tests, and the issue is a result of page->save() not working for custom image fields. Saving the image field (inside or outside the loop) is necessary to save the content of the image custom fields. Saving the page (inside or outside the loop) does nothing for the image custom fields. It seems to me that saving the page should work as it does with other fields, and I have reported this as an issue https://github.com/processwire/processwire-issues/issues/1334 However, there may be a good reason for it behaving as it does, and it has been pointed out on the issue page that the Table Profield behaves in the same way.
  11. I did this a few weeks ago and I got it to work. I seem to remember I had a certain amount of trouble saving the record, but I can't remember what exactly. However, the following code worked (I've simplified getting the text to add to the image fields). Note that I've done something a bit weird and saved both the field and then the page. This might have been an error (I was running a one-off process), or I might have found it was necessary for some reason I don't understand. It may just be that saving the field is what does the trick. Also, for reasons of my own, I used $record as a page variable, but I don't see why this would matter. Otherwise, I can't see any difference between this and your code. foreach($selectedRecords as $record) { if(count($record->article_images)) { $record->of(false); foreach($record->article_images as $image) { $image->photo_caption = "Some caption text"; $image->photo_credit = "Some credit text"; // First save $record->save('article_images'); } // Second save! $record->save(); } } Hope this helps, and I'd be interested if you find this works and can figure out what actually fixes the problem.
  12. Following on from what @teppo suggests, note that it's quite straightforward to write a script to import images into image fields on pages. There's lots of help on the forums for doing this (as a starting point, https://www.google.com/search?as_q=import+images&as_sitesearch=processwire.com). So, if you have a way of getting the image URLs into text fields (which it seems you have), you could write a script to run over the pages, loading the image(s) from the URL(s).
  13. I don't know of a way to do this with the template settings. However, if you want to the date to appear for only a particular template, you could add a check like this: wire()->addHookAfter('ProcessPageListRender::getPageLabel', function($event) { $page = $event->arguments('page'); // Check template if($page->template->name == 'relevant-template') { $modifiedFormatted = date("j.n.Y", $page->modified); $event->return = $event->return . ' ' . $modifiedFormatted; } });
  14. Welcome to the PW forums! The first thing I'd suggest, looking at the second line of the backtrace, is setting protectCSRF to false in config.php: $config->protectCSRF=false; If that doesn't get you in, take a look at https://processwire.com/docs/start/install/troubleshooting/ And then you may need to go back to working through posts: https://www.google.com/search?q="This+request+was+aborted+because+it+appears+to+be+forged"+site%3Aprocesswire.com%2Ftalk This one is a useful starting point:
  15. One approach would be to use a hook in ready.php, adapting the method described in this post: You'd probably end up with something like this (not tested): wire()->addHookAfter('ProcessPageListRender::getPageLabel', function($event) { $page = $event->arguments('page'); $modifiedFormatted = date("j.n.Y", $page->modified); $event->return = $event->return . ' ' . $modifiedFormatted; });
  • Create New...