Jump to content

froot

Members
  • Posts

    720
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by froot

  1. OK I had some sort of success with the contact form. Apparently $mail->AltBody = $message; destroys the line-breaks of the message. When I remove this, it sends emails with line breaks, that's all the message via contact form needs anyway. But I'm still having troubles with the newsletter though, I'd appreciate if someone could just thought-shower with me, I'm out of ideas. It doesn't use any more code other than what is in the email's template (shown above) which is the code provided template when you buy it (!). Other than that, as far as I know, it completely relies on what I configure in the modules' settings. But no matter what I do, it just won't send any markup or css styles. I don't even understand what's happening and google is no help either. So is it the ProMailer module? (I hope not), the WireMailPHPMailer? (positive), the mail server settings? or my email client? (unlikely) I also changed the content-type of the template for the promailer-email template for the newsletter emails to "text/html". No success. Thanks for help!
  2. mails get sent now, contact form and newsletters. However, I struggle with sending HTML content with ProMailer via WireMailPHPMailer. The issue definitely is with WireMailPHPMailer because HTML emails get sent just fine via regular php. Also, on the newsletter template I have if($input->get('type') === 'html') { ?> <!DOCTYPE html> <html> <head> <!-- <meta http-equiv="content-type" content="text/html; charset=utf-8" /> --> <meta http-equiv="content-type" content="html; charset=utf-8" /> ... etc. And it always enters this block, no matter what is sent, but it always "auto generates" text, I guess, and strips the HTML. Don't know why.
  3. done and done, thanks
  4. Markup Google reCAPTCHA doesn't allow recaptcha v3, only v2, and firefox won't work with recaptcha v2, only v3 ?
  5. when I install this module, it messes up my <head> tag big time. The tags get added INSIDE the <title></title> tag (!) see for yourself: view-source:https://foobar.roofaccess.org/contact/ thoughts?
  6. I keep getting these errors (just one of them at a time)… PHP Notice: Undefined offset: 1 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:3310 PHP Notice: Undefined offset: 1 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1743 PHP Notice: Undefined offset: 3 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1656 PHP Notice: Undefined offset: 3 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1619 thoughts?
  7. Thanks but no, that doesn't seem to be the problem. I'm now using WireMailPHPMailer which works fine. The contact form at least which uses the code and API I wrote on the contact form's template file. So that's good, at least I know the module is working and the connection to the SMTP server is established. Rock-mail-logger is also good as a log-tool. Still having issues with sending newsletters with Promailer via WireMailPHPMailer though, which doesn't use any custom code AFAIK, just the settings in the module. But that's to be discussed in the VIP support.
  8. OK so I'm in a pickle now, no email module seems to work. As mentioned above, I had been using the php mail function before, which worked ok for some time, but then not anymore. So I learned about WireMail SMTP and that sending via SMTP is always better in terms of spam protection. As required by the host (World4You), I setup an authenticated user in the settings with port 587. This worked fine for some time, now it doesn't anymore. Now I installed SwiftMail which also has test connection and test email features. I tried these tests, both are claimed successful, no errors, but no emails get received. This is scary! Is there any mail module that actually works? There are no errors neither on PW nor on the server, just success messages from PW. How to debug this stuff? Need help urgently!
  9. WireMail SMTP, WireMailPHPMailer or SwiftMailer - which one is state of the art? Or any other? What are the pros and cons? I tried WireMail SMTP, it doesn't seem so reliable. Many people seem to be in favor of WireMailPHPMailer, but that needs some attention, but before I start, there's also SwiftMailer, so I don't know what's the best bet and which one's the newest.
  10. @MoritzLost You seem to have quite some experience with PW's mail functions. Would you have time and feel like taking a closer look at my setup?
  11. on the very template itself, outside of any ifs and elses so that it's included with or without ajax making the call. You don't have to be sorry, your advice helped a lot!
  12. …that was key, because putting it on config.php doesn't do anything. It's like: you had one job!! Thanks, looks like you were right again after all, kind of ?
  13. tried that already, no luck
  14. thanks, I tried, but doesn't help. Also I can tell the issue doesn't seem to be the database because content from the db with äöüß gets displayed correctly, it's just the date, in German that'd be März (for march) that is displayed wrong. So I understand I don't need to fix the database, just tell php that it should be UTF-8 somehow, it seems to miss that part somehow since I moved some files around. Also, there's supposed to be a php header (?) like… header('Content-type: text/html; charset=utf-8'); I put this in the <head> also tried to include it earlier, in _init.php and even earlier in ready.php, doesn't help either.
  15. it wasn't hooks either. I fooled around a bit more and realised that it has to be the code that runs on the server to create the ajax response text. I replaced the entire code with just a simple echo command which was super fast, that's how I knew. But for some reason, it's faster now, even with the code, I'm not sure what exactly got it to work. Anyways, hard to say how to improve the code, I use a foreach loop with certain if-conditions to filter instead of proper PW-selectors. Here's my code: $year_start = $y.'-01-01'; $year_end = $y.'-12-31'; $year_overview = new WireArray; foreach ($all_events as $ae) : if ($ae->date_start<=$year_start && $ae->date_end>=$year_start && $ae->date_end>=$ae->date_start) : $year_overview->add($ae); elseif ($ae->date_start>=$year_start && $ae->date_end<=$year_end && $ae->date_end>=$ae->date_start) : $year_overview->add($ae); elseif ($ae->date_start<=$year_end && $ae->date_end>=$year_end && $ae->date_end>=$ae->date_start) : $year_overview->add($ae); endif; endforeach; echo table_events($year_overview); The code works fine. That said, I also still don't know how to save the variables in the in-memory database and then just access and filter what's in that memory instead of fetching from the database every time anew, I guess that would speed things up as well? Where can I see what's "in-memory", Tracy Debugger? https://processwire.com/talk/topic/6246-table/?do=findComment&comment=207312 More importantly, I'm facing another problem now which I didn't have in my previous setup, which is that Umlaute äöü don't get displayed correctly, instead I see this stuff: ���. I read online that it has to do with the database of which the collation is set to "utf8_general_ci" when it should be "utf8mb4_unicode_ci"? But I have doubts because it used to work before and I would rather not fool around with the database at all. Need to fix this quickly, it's live… Thanks for help
  16. I'm using TracyDebugger but it's a jungle to me, not sure how to use it efficiently. Google PageSpeed Insights can be useful though. I will check the hooks then. Thanks so far.
  17. do you reckon using json-encoding would speed things up? PW is so proud of being so fast, here it fails ?
  18. yes that's exactly what it looks like…
  19. OK I re-activated the automatic inclusion of _main.php on the template settings, added $this->halt(); // also tried with return $this->halt(); makes sense and it does the same, so much so that it's not faster either.
  20. Thanks for the suggestion, however I don't use json output, it's just a php code that is called, that renders html markup. Not sure if that's the issue.
  21. is it a cache problem? some bottleneck? some redundant code? no idea how to even start, tracy debugger is not helping either.
  22. I now got it working like this: I exclude the _main.php (which includes the _head.php and all) on the template settings. I then create an if-condition on the template file, dividing the content as follows <?php namespace ProcessWire; if (!$config->ajax) { // here's all my static stuff echo '<div id="content">'; echo '<div id="dynamic">'; // place for the ajax response text by replacing the innerHTML echo '</div>'; echo '</div>'; ... include 'includes/_main.php'; } and else { // here's all my ajax loaded code/content from the server } lastly, I put: <script type="text/javascript" src="path/to/my/javascript.js"></script> My AJAX request looks as follows function getContent() { var xhr = new XMLHttpRequest(); if (xhr) { xhr.onreadystatechange = replaceContent; xhr.open("GET", "./?some=variable&someother=variable, true); xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.send(null); }; }; function replaceContent() { xhr.readyState; if (xhr.readyState == 4 && xhr.status == 200) { var str = xhr.responseText; document.getElementById("dynamic").innerHTML = (str); }; }; It works, like it did before, except that now it is very slow. In my console I think I can see that the request gets sent quickly but the server takes about 5 seconds to respond so it's mostly waiting. I tested on my local MAMP machine (which is always slower) and live server, both have the same problem. So the TTFB is 4.51s, if I put the ajax-requested file in the root folder (as described in the the initial thread) I have a TTFB of 775ms thoughts?
  23. thanks @Jan Romero works like a charm. I wonder if that is best practice to jump in and out of namespaces, but I guess it doesn't matter. Also curious why that namespace declaration is necessary, cause I have created my own functions before, no problem. And, again, wondering how you know this and how I could know something like this without having to ask.
  24. actually the following would help me a lot if it worked, don't know why I didn't consider it, it's simple enough as it is. https://www.w3schools.com/php/php_callback_functions.asp But weirdly, if I use the code of the last example (user defined function) in PW, I get an error: Call to undefined function exclaim()
  25. now it works, thanks @Jan Romero May I ask how you know that?
×
×
  • Create New...