Jump to content

Smoo

Members
  • Content Count

    22
  • Joined

  • Last visited

Everything posted by Smoo

  1. That did it - thanks. $page->meeting_event_pdf_attachment rather than $page->files in my case - just in case anyone else is reading this. Cheers.
  2. Rusty newbie here... I have a template called MeetingEvent, to which I've added a file field to allow uploads of multiple PDFs. The field is called meeting_event_pdf_attachment. Users may attach any number of files to this field, and it's set to provide an array of items (for simplicity). I'm having trouble getting the filename and path out of the supplied data - surely I've forgotten some bit of PHP syntax here. If I do var_dump($page->meeting_event_pdf_attachment); I get something that looks like this: object(ProcessWire\Pagefiles)#415 (2) { ["count"]=>; int(1) ["items"]=>; array(1) { ["accessibility.pdf"]=>; string(17) "accessibility.pdf" } } (In this example, my attached file is called "accessibility.pdf") var_dump($page->meeting_event_pdf_attachment->count); outputs int(1) as expected. var_dump($page->meeting_event_pdf_attachment->items); outputs NULL. I was expecting ->items to be an array - it sure looks like one. I need to be able to walk through "items" and grab the URL for the things listed there, but with it being NULL, I'm kind of perplexed as to how to do that. Should I be using a repeater instead? Any advice appreciated.
  3. Thanks guys - that's exactly what I was looking for.
  4. Hi folks. I'm finding our email contact form is truncating messages, whose body is coming from a text area, to 50 characters. Turning off sanitizer for that field removes the problem: //$message = $sanitizer->text($input->post->message); -- truncates $message = $input->post->message; // -- passes full text However I'd still like to have some cleanup performed on user-generated input. Is there a way to set a higher character count for this field? TIA...
  5. Forgive me if this is documented somewhere... I've spun up a dev instance of our project and turned on debug mode. The way our layouts work, the debug output is covered by some page elements, so I'd like to be able to wrap the notices in a container that I can control the placement of. Is there a way to control that output? I've looked in Debug.php and that's not helpful - just a bunch of classes relating to timers. Any guidance appreciated.
  6. Actually i completely worked around this, pulling apart the object returned by $recurme->event() and formatting the whole setup myself. But next time... Anyway thanks for the tip.
  7. I'm trying to pass options to both renderEvent() and renderList(), but the functions aren't picking up my settings. Here's code from my list display page: $siteEvents = $pages->find("template=meetingevent, sort=meeting-event-date-recurring"); $options = array( 'selector' => '', 'monthFormat' => 'F', 'dateField' => 'recurme', 'renderEvent' => array( 'dateFormat' => 'M d, Y @ g:i a', 'timeFormat' => 'g:i a', 'dayFormat' => 'd', 'monthFormat' => 'M', 'yearFormat' => 'Y', 'hourFormat' => 'g', 'minuteFormat' => 'i', 'secondFormat' => 's', 'ampmFormat' => 'a', 'xBefore' => '<li class="rm-list-event {original.name}">ASDF<span class="rm-event-date">{time}</span> ', 'xItem' => '<a href="{link}" title="{title}">', 'xAfter' => 'STRING {title}</a></li>' ), 'renderDay' => array( 'xBefore' => '<ol class="rm-list-day {todayClass} rm-{dayName}"><li><h3>', 'xItem' => '<span class="rm-date-day">{day}</span><span class="rm-date-month">{month}</span><span class="rm-date-year">{year}</span></h3>', 'xListBefore' => '<ol class="rm-list-events">', 'xListAfter' => '</ol><!-- close list-events -->', 'xAfter' => '</li></ol><!-- close day -->' ), 'renderMonth' => array( 'xBefore' => '<ul class="rm-list-month rm-{month}"><li>', 'xItem' => '<h2>{month}</h2>', 'xAfter' => '</li></ul><!-- close month -->' ), 'cache' => true, 'cacheName' => '', 'noEvents' => '<p>No events to show!</p>', ); $content .= $recurme->renderList($siteEvents, $options); Output looks like the attached screen shot. Note that I'm not seeing any of my customization (I changed the UL to OL and added some strings, to test). I'm also not seeing Dates displayed. Clearly I've missed something here - any help appreciated.
  8. The fix seems to be to set all events as recurring, and use a count of one for events that don't actually recur.
  9. This option isn't present for a Select (Options) element. I'm going to rethink the setup - probably make each Photographer a page, and then use a page reference in the Uploaded Photo template.
  10. Hi folks. I have a taxonomy of photographers to use in photo credits - the content editor simply picks the correct one from a SELECT element after she's uploaded a photo. I'd like to allow the editor to add a new name to this list when she's uploading the photo, without having to switch gears and visit the options list on the field page. Is there a module to enable something like this? or any clever ideas? TIA...
  11. Smoo

    Disable cache?

    Thanks, guys - I'll try Soma's module first. Cheers
  12. Hi folks. Is there a way to disable caching entirely during development?
  13. I'm having a similar problem to SoccerGuy above. All I'm trying to do is display the start date of an event on the event's page, and I can't help feeling this shouldn't be this hard. What have I missed? Experiment 1 - $content .= $recurme->renderEvent($page); This returns <li> • <a href="?date=" title="Test Event 1">Test Event 1</a></li> where Test Event 1 is the title of the current page. Experiment 2 - $rcoptions = ['timeFormat' => 'g:i a', 'dateFormat' => 'M d, Y @ g:i a', 'dayFormat' => 'd', 'monthFormat' => 'M', 'yearFormat' => 'Y', 'hourFormat' => 'g', 'minuteFormat' => 'i', 'secondFormat' => 's', 'ampmFormat' => 'a', 'xBefore' => 'TEST', 'xItem' => '{time} &bull; <a href="{link}" title="{timestamp}">ABCDEF{timestamp}</a>', 'xAfter' => '']; $content .= $recurme->renderEvent($page, $rcoptions); This returns the same thing as the first experiment, apparently ignoring the $rcoptions object I passed in. Note that I attempted to change the xItem element, but no joy. Experiment 3 $event = $recurme->event($page); $content .= "Event: " . $event; $content .= "Orig Date: " . $event->orig_date; This outputs Event: and Orig Date: strings, but nothing else. Clearly I have no idea what I'm doing - any guidance appreciated.
  14. Got it. Thanks - this community thus far has been quite pleasant and welcoming. Cheers
  15. Well that's tidier - thanks. What does the - flag before the field name do?
  16. Excellent info - thanks for that.
  17. Hi folks. Newbie here - on PW for a couple of weeks now (I've been a Drupal developer for over 10 years). I've created a template for a Meeting and Event item, which has a title, description and date (a Unix timestamp, called "meeting_event_date"). I also have two templates for displaying lists of these things, one more or less full page and the other as a small block with reduced content to be placed on other pages. So far so good - I can get all the Events pages using $meeting_events = $pages->find("template=meetingevent"); Then I use a foreach to walk $meeting_events and pull out the date, title and description of each event, wrapping them in my markup as I go. The trouble is they're coming in in date-created order (based on the metadata of the Events pages, I guess) whereas I'd prefer to be able to sort them by the actual Event date (which is a field on the Event). I could of course pull the Events from $meetings-events apart and push the individual events into an intermediary array, sort that by the timestamp value, and then walk it to pull out the data into my markup, but I can't help feeling there's a better way. Is there a way to sort the $meetings_events array before running the foreach? I've tried $meeting_events->sort("meeting_event_date"); but that's having no effect. UPDATE - just needed to wait for the template to re-compile. Apparently that's not instantaneous...? I still need to understand caching in this environment. The sort() method above worked. Leaving this here in case it helps someone else.
  18. Thanks guys, I guess for now I'll just add an "Images" field to the template and have that be the container for inserted images. I'll admit I'm finding this a bit convoluted but we'll make it work for our users. @BitPoet - I'll check out your Media library module in addition.
  19. Newbie here - first week on PW. Perhaps I've missed a setting - entirely possible - but I can't figure out how to insert an image into the CKEditor if it's not already attached to a page. i'd really like to allow my users to upload an image while they're composing content in the WYSIWYG editor. Is this possible?
  20. Yep, that was it - thanks.
  21. Hi - newbie question here. I have a field called footer_center_section, whch is a text area. it's set to use CKEditor as input. When I'm outputting this field, I'm seeing the markup as well as the content, rather than just the content. In my template I've got <?php echo $footer_center_section;?> Output is shown in the attached screen shot. Is there some property of a text area field that I should be using, rather than the object itself? Any guidance appreciated.
×
×
  • Create New...