Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

49 Excellent

About BillH

  • Rank
    Full Member
  • Birthday 03/06/1962

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    London, UK

Recent Profile Visitors

1,213 profile views
  1. If I understand you correctly, you'll find the answer here: https://processwire.com/docs/fields/select-options-fieldtype/ See the section titled "Getting the id property of an option when you only know the title".
  2. Might RockFinder speed things up sufficiently? Latest version at https://github.com/baumrock/rockfinder3. I'd expect it to reduce your query times greatly - probably well under a second. And you can keep using PW selectors.
  3. The field page2use4homepage will return a null page (id = 0) if no page is selected, which might be confusing things. I haven't tested, but I'd suggest using: (($page->id == 1) && ($page->page2use4homepage->id != 0))
  4. This happened to me once when I moved a site to a new server and accidentally used details for remote access to the first server for dbHost. Took me a while to figure it out! There can be various sorts of caching on the server, which may have been set up as a default by the hosting company without you being aware of it. They don't usually cause problems, but they might. What sort of server setup do you have?
  5. I suggest that first you find the error in the HTML as delivered to the browser, and then work out the source of the error. View the source of the page or your browser's developer tools ("Inspect"). If you can't work it out, try an HTML validator (e.g. https://validator.w3.org/). An <a> element within a <p> is certainly OK. With any luck, once you know what the error is, the cause will be reasonably clear. As a total guess, I suspect it'll be something in your template file.
  6. In what @kongondo suggests, replace "config" with "page" or "pages".
  7. Hadn't read your original post properly 🙁 Just another thought: do you need to use datetime fields? If there are a fairly limited number of possible start and end times during the day, you could set up pages for each time, and select using page reference fields. The time pages could have fields with formatted and numerical representations of the time. To find pages in a time range, you'd find the relevant time pages, and then use those to find the courses, something along the lines of this: $startTimes = $pages->find("template=times, time>=1200, time<=1400"); $endTimes = $pages->find("template=times, time>=1500, time<=1700"); $courses = $pages->find("template=course, start_time=$startTimes, end_time=$endTimes"); Not tested, but I think it'd work.
  8. I think the information you need is in this post: So, in brief, the values in a selector should be UNIX timestamps. Note that, in a template, if you get a date from a field it will be formatted according to the settings for the field, but you can use $page->getUnformatted('your_date_field') if you need the timestamp.
  9. If you can't put the iframe in a template (as @kongondo suggests) and need it in a CKEditor field, it'd be worth considering (if you haven't already) the Hanna Code module.
  10. And another question: how much data do you have in that field and across how many pages? I ask because one possible option, if you get really stuck, might be to delete the field and recreate it.
  11. Just another guess, but as the error occurred in modules.php (though this may just be when the memory ran out), it might be worth clearing compiled files as well, if you haven't done it already. Modules > Site > Clear Compiled Files (at the bottom of the page).
  12. When you say you have deleted the cache, do you mean your browser cache or PW cached files? If you haven't cleared PW cached files, they're at Site > Assets > Cache, and it's probably just the ones in Page that might be relevant. You can simply delete everything in the folder. Alternatively, you can clear cached page output by going to Modules > Core > PageRender > Settings. I don't know if this will help, but it's worth a try.
  13. You need to check whether there's something in the end date field. Then, if you're going to use the value in a function, you need to give it a suitable value if there's nothing in the field. For example: if ($single->End_date) { $end = date('d. m. Y', $single->getUnformatted('End_date')); } else { $end = date('d. m. Y', 0); // This would be 01.01.1970, but you might want something in the future } I also note that you are getting the unformatted dates from the fields and then formatting them again with the date() function. As you are just comparing values (at least in the code you have posted), you could simply use the values from the fields, or the unformatted value if it's easier to work with UNIX times. And you have $today == $start twice in your first 'if' condition!
  14. Trying to manage folders yourself would be seriously hard work and difficult, as discussed in this post: If a high proportion of your pages don't have images, and the total number of images is well under half the number of pages, you could take a one-image-per-page approach, with each image held in sub-page. A couple of modules that might help with this are: https://modules.processwire.com/modules/repeater-images/ https://modules.processwire.com/modules/process-visual-page-selector/
  15. The idea from @Ivan Gretsky of using template tags (which are on the Advanced tab of Edit Template) seems like a really good one. An approach to searching for tags on templates is here: Another possibility would be to prefix each relevant template name (e.g. "prefix-templatename") and then find using the "starts with" operator: $foundPages = $pages->find("template^=prefix"); But I think the tags approach would probably be better – more flexible, and organises things nicely on the Templates page in the admin.
  • Create New...