Jump to content

ngrmm

Members
  • Posts

    475
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by ngrmm

  1. i have a event-page with a table. first column in this table is page-reference-field how can i find out if a urlSegment matches one of the rows having the same page-reference-field (page-id)? // all guests $allguests = new pageArray(); foreach($page->event_guests_table as $event_guests_table_row) { $allguests->prepend($event_table_row->guest); } // echo allguests would output: 1101|1102|1103|… // domain.tld/event/1101/ // show content if guest is in the table or redirect if($input->urlSegment1 ~= $allguests ) { // show content } else { // redirect } which selector operator do i have to use? the one above does not work
  2. i bypassed it with a static helper-array and it works. would be nice to know how to do this without a helper array $mNames = array("zero", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"); $ms = wireArray(); $m1 = date('n', 1579643232); // 1 $m2 = date('n', 1583107200); // 3 $ms->prepend($m1); $ms->prepend($m2); foreach($ms as $name) { echo "$mNames[name] "; } // result: Januar März
  3. I want to have filters with month names in german. I fetch them from date-fields with strftime('%B', $timestamp); But i'm not able to add them correctly to a wireArray() What's the right way to do that? $ms = wireArray(); $m1 = strftime('%B', 1579643232); // Januar $m2 = strftime('%B', 1583107200); // März $ms->prepend($m1); $ms->prepend($m2); foreach($ms as $name) { echo "$name "; // result: Januar M�rz }
  4. thx it's weird, maybe i try mailgun and see what happens there
  5. hi @guy i corrected that comma on line 132 still getting no statistics/activity-data on sendgrid. maybe its like this because of SSL (https)?
  6. did the update i guess there's a typo this appears on the settingspage of the module
  7. hey @guy i installed this module and have a free-sendgrid account. generated an API key and did this: $m = new wireMail(); $m->body('hello'); $m->from($email = 'test@test.com', $name = 'John'); $m->to($email = 'mail@test.com', $name = 'Jane', $substitutions = null, $subject = 'TESTING'); $m->___send(); Email is send out and delivered. But i don't see any statistics about them being sent on sendgrid. Did i forgot something? Tracking is enabled.
  8. Got it working by using two loops. One for sending out emails and the other for changing the value. … // loop through table and send out emails foreach($event->event_clients_list as $event_table_row) { // get client page $clientPage = $event_table_row->client_name; // get client email $clientEmail = $clientPage->email; // email html body ob_start(); include('./_inc/emailbody.inc'); $emailBody = ob_get_clean(); if($event_table_row->client_invited == '') { // send email $m = new WireMail(); $m->to($clientEmail); $m->from($fromEmail, $fromName); $m->subject($emailSubject); $m->bodyHTML($emailBody); $m->send(); } } // make event-page editable $event->of(false); // loop through table and change value foreach($event->event_clients_list as $event_table_row) { // if client isn't invited yet (checkbox not checked) if($event_table_row->client_invited == '') { $event_table_row->client_invited = 1; $event->save('event_clients_list'); } }
  9. thank you @rick it works! here the code: // event ID $eventID = $input->get('eventID','int'); $event = $pages->get($eventID); // config $testEmail = $event->event_mail_test_adress; $fromEmail = $event->event_mail_from; $fromName = $event->event_mail_from_name; $emailSubject = $event->event_mail_subject; $filenameDate = strftime('%d-%m-%Y', $event->date_start); // filename $filename = "{$event->name}_{$filenameDate}"; // create ics file $file = fopen('ics/'.$filename.'.ics', 'w') or die('File can not be saved!'); // fetch start date $event_start_ts = $event->getUnformatted("date_start"); // build the .ics data $ical_data = "\r\n"; $ical_data .= 'BEGIN:VCALENDAR'; … … … $ical_data .= "\r\n"; $ical_data .= 'END:VCALENDAR'; fwrite($file, $ical_data); fclose($file); // HTML BODY ob_start(); include('./_inc/emailbody.inc'); $emailBody = ob_get_clean(); // send email $m = new WireMail(); $m->to($testEmail); $m->from($fromEmail, $fromName); $m->subject($emailSubject); $m->bodyHTML($emailBody); $m->attachment('ics/'.$filename.'.ics'); $m->send();
  10. Filename is a $page->name Sorry, i'm not an expert. What kind of headers do i need? And how do i define a boundery? Is there a manual how to that?
  11. i'm trying to attach a .ics-file to a mail The Page send sends out the email but only download the ics-file. Email has no attachments. // event ID $eventID = $input->get('eventID','int'); $event = $pages->get($eventID); // config $testEmail = $event->event_mail_test_adress; $fromEmail = $event->event_mail_from; $fromName = $event->event_mail_from_name; $emailSubject = $event->event_subject; // .ics $filename = $event->name; header('Content-Encoding: UTF-8'); header('Content-type: text/calendar; charset=utf-8'); header("Content-Disposition: attachment; filename={$filename}.ics"); // fetch start date $event_start_ts = $event->getUnformatted("date_start"); // build the .ics data $ical_data = 'BEGIN:VCALENDAR'; $ical_data .= "\r\n"; $ical_data .= 'VERSION:2.0'; $ical_data .= "\r\n"; $ical_data .= 'CALSCALE:GREGORIAN'; $ical_data .= "\r\n"; $ical_data .= 'METHOD:PUBLISH'; $ical_data .= "\r\n"; $ical_data .= 'BEGIN:VEVENT'; $ical_data .= "\r\n"; $ical_data .= 'SUMMARY:'.$event->title; $ical_data .= "\r\n"; $ical_data .= 'UID:' . md5(uniqid(mt_rand(), true)) . '@'.$config->httpHost; $ical_data .= "\r\n"; $ical_data .= 'CLASS:PUBLIC'; $ical_data .= "\r\n"; $ical_data .= 'STATUS:CONFIRMED'; $ical_data .= "\r\n"; $ical_data .= 'DTSTART:'.date('Ymd', $event_start_ts).'T'.date("His", $event_start_ts); $ical_data .= "\r\n"; $ical_data .= 'DTSTAMP:'.date('Ymd').'T'.date('His'); $ical_data .= "\r\n"; $ical_data .= 'LOCATION:'.$event->venue; $ical_data .= "\r\n"; $ical_data .= 'URL:'.$event->httpUrl; $ical_data .= "\r\n"; $ical_data .= 'END:VEVENT'; $ical_data .= "\r\n"; $ical_data .= 'END:VCALENDAR'; // HTML BODY ob_start(); include('./_inc/emailbody.inc'); $emailBody = ob_get_clean(); // send email $m = new WireMail(); $m->to($testEmail); $m->from($fromEmail, $fromName); $m->subject($emailSubject); $m->bodyHTML($emailBody); $m->attachment($ical_data); $m->send();
  12. I have a page with a table. Each table row has a page-reference field and a checkbox. The Page sends emails to all users (page-refrence->email-field) and change the value of the checkbox in a row to 1. It works with this: <?php // event ID fron url query $eventID = $input->get('eventID','int'); // get event-page $event = $pages->get($eventID); // config $fromEmail = $event->event_mail_from; $fromName = $event->event_mail_from_name; $emailSubject = $event->event_subject; // email html body ob_start(); include('./_inc/emailbody.inc'); $emailBody = ob_get_clean(); // make event-page editable $event->of(false); // loop through table and send out emails foreach($event->event_clients_list as $event_table_row) { // get client page $clientPage = $event_table_row->client_name; // get client email $clientEmail = $clientPage->email; // if client isn't invited yet (checkbox not checked) if($event_table_row->client_invited == '') { // send email $m = new WireMail(); $m->to($clientEmail); $m->from($fromEmail, $fromName); $m->subject($emailSubject); $m->bodyHTML($emailBody); $m->send(); // mark client as invited $event_table_row->client_invited = 1; $event->save('event_clients_list'); } } ?> But i have to use a variable in my emailbody.inc which i'm able to get in the table-loop. So i do the including of the body inside my loop. But this doesn't work anymore. Page sends out the emails but is unable to change the value of the checkbox. I get no errors! I'm using ProTable <?php // event ID fron url query $eventID = $input->get('eventID','int'); // get event-page $event = $pages->get($eventID); // config $fromEmail = $event->event_mail_from; $fromName = $event->event_mail_from_name; $emailSubject = $event->event_subject; // loop through table and send out emails foreach($event->event_clients_list as $event_table_row) { // get client page $clientPage = $event_table_row->client_name; // get client email $clientEmail = $clientPage->email; // email html body ob_start(); include('./_inc/emailbody.inc'); $emailBody = ob_get_clean(); // make event-page editable $event->of(false); // if client isn't invited yet (checkbox not checked) if($event_table_row->client_invited == '') { // send email $m = new WireMail(); $m->to($clientEmail); $m->from($fromEmail, $fromName); $m->subject($emailSubject); $m->bodyHTML($emailBody); $m->send(); // mark client as invited $event_table_row->client_invited = 1; $event->save('event_clients_list'); } } ?>
  13. @Kiwi Chris thx!
  14. i'm not an expert. But a workaround would be to have different search results in different arrays. First searching for abc. An then searching for ab, ac, bc inside abc and so on
  15. I have a page which sends out an email based on queries in the url <?php // event ID $eventID = $input->get('eventID','int'); $event = $pages->get($eventID); // config $adminEmail = "events@test.com"; $fromEmail = "noreply@test.com"; $fromName = "test"; $emailSubject = "Test Email"; // HTML BODY $emailBody = ""; // HOW TO ??? … // send mail $m = new WireMail(); $m->to($adminEmail); $m->from($fromEmail, $fromName); $m->subject($emailSubject); $m->bodyHTML($emailBody); $m->send(); ?> The email body is a bit complex: standard html/css tables and some php (pw variables). I put my emailbody (html) in a seperate file emailbody.inc but don't know how to include it?
  16. great module @David Karich, thx! will there be an option to cross-copy-paste content between two different matrix-repeater-fields with same matrix-repeater-field-types (same configuration)? is or is this not possible?
  17. thx @Jonathan Lahijani, i'm not a pro and don't know how to do your workaround. but it tried it with simple str_replace() and it works ? $content = $page->body; echo str_replace("<a","<a style='color: red'",$content);
  18. i'm using a pw-page to output a newsletter-email and send it via promailer. this page has a textarea-field (ckeditor). i searched a lot but was able to find out how to automatically add inline style to a-tags. like: <a href="#" style="color:red;">…</a> adding a class via mystyles.js or config.js will not work because it's a newsletter-email. mail-apps would override class-styles. it has to be inline
  19. thx @dragan and @flydev ok i understand. this also means that i'm not able to remove items (fields) with ->remove()?
  20. i want to output some of my pagefields as options in a html select tag i can do this this way: $search_options = $templates->get("catalog_item")->fields; but i'm not able to sort them: $search_options = $templates->get("catalog_item")->fields("sort=label"); array_multisort() ksort() doesn't work either. is sort limited to pagearrays?
  21. try to use RewriteBase /page in your htaccess no need for a RewriteRule
  22. thx but how do i extend it globally in config.php? is there something like this? $config->sanitizer->pageNameUTF8(int $maxLength = 200);
  23. i get 404-Errors when my url is longer than 128 characters using pw 3.0.127 where do i find the options to set a higher limit?
  24. i'm trying to reduce redundancy and creating a structure which can be used later (relation-links) some existing should be also used as tags beside the new ones. yes yes ok, i though PW would use the first settings (parent/template) for creating the new pages, and additional setting and selector for additional options any tutorials/how-to for backend-hooks?
  25. i'm using a page-field with the inputfield-chosen-select-multiple as a tag-system – there are two different templates (template_A & template_B) which can be chosen – and both have different parents (parent_of_A's & parent_of_B's) – new pages (tags) generated from this field should be children of parent_of_A's and have template_A so i've chosen parent_of_A's as the parent and template_A as template. and selected template_B as extra template. this is must because that how the system know where to put the new pages. but this does not work when i try to add other templates as extra-templates or with the selector string method. error says: not the right template only using selector-string-method works for choosing, but no new pages can be generated
×
×
  • Create New...