Jump to content

Funce

Moderator
  • Posts

    602
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by Funce

  1. This doesn't require anything particularly special.

    If you want AJAX, you can change  the `getValues()` function to send an AJAX request with the FormData object as the payload. Look here: https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects

    If you don't need AJAX, then a standard form submission would take care of this easily. Remove the onClick method and change the button type to "submit". That would submit as per a normal form. (Sending through the action URL)

  2. 9 hours ago, justsomeguy said:

    Paste the error messages

    There's gotta be some error messages in that last lot of code you posted, Html.
    I can see a syntax error in line 14, an undefined error in line 21. 

    Copying the error messages helps us more than describing them.

  3. Usually font discrepancies indicate that the fonts specified on a website, aren't installed on the machine you're viewing it on. This is usually prevalent if you're specifying a font, but not including the font library on your webpage for those that don't have it.

    However, you stated that you're using google fonts. How are you linking these? Can you create a small example of this? I suspect that your link may have something wrong with it (Maybe a typo or something). 

  4. 20 minutes ago, Cristiano said:

    I created the site http://cristianopi.altervista.org/as_old/ and the file .htaccess:

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^as_old/index.html$
    RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js)$
    RewriteRule .* /as_old/index.html [L,R=302]

    but when I click a link on the index page, the index page itself is loaded into the iframe (instead of the page in the link).

    I see, you'll probably need a server side language like PHP instead. I've misunderstood your issue.

  5. 20 minutes ago, iwato said:

    Thank you, Funce.

    Both of those were silly errors on my part.

    I have been a little overwhelmed with this entire task, and if this is all the errors  that can be found, then I will be most elated.

    Already you have earned a trophy.  Simply I have not added it yet out of fear that everyone will stop looking for more holes to poke. 🙂

    Roddy

    No worries Roddy, I'm not too familiar with PHPMailer myself, (I went hunting viciously for what msgHTML() was) but from my cursory evaluation (without a PHP parser) it otherwise looks okay.

  6. Hi there Roddy,

    I'm going to poke some holes in the implementation.

    1. require_once shouldn't have an `=` in it, semi-colon at the end.
    2. You're calling your PHPMailerFactory as if it had a constructor function, from your latest post it seems like it doesn't. Instead call it like:
       
      <?php
      $newsletter = PHPMailerFactory::create('newsletter', $username, $email);
      ?>

       

  7. Perhaps this has more information for you:

    https://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format

     

    The field that's shown is locale specific to browser. The date picker I see(Chrome) inputs as DD/MM/YYYY as that's how dates are written in New Zealand.

     

    If you're referring to the output of the date input, then you'll need to look into string manipulation. Anything with locale based input should always output in a standard fashion. This allows any program using the output to function in any locale.

  8. I've done some investigating for you, and it seems that w3-table actually overrides the colgroup styles.

    Disabling the styles associated with the revealed the Colgroup styles as normal. 

     

    That codepen you linked looked especially good. What happened with that one?

  9. Hi there Sonalk!

    In terms of your second half:

    This one is a really easy one to overlook. I don't blame you for getting tripped up on this one

    function specificName() {
        var x = document.getElementById("myTopnav");
        if (x.className === "topnav") {
            x.className += " responsive";
        } else {
            x.className = "topnav";
        }
    }

    Your JavaScript is looking for an element with an `id` attribute of `myTopnav` but your `<a>` tag seems to be missing an id attribute altogether (Which I assume is the tag you want to retrieve).

     

    If you add an id that matches your JavaScript, I reckon you might get a better result.

  10. 7 hours ago, iwato said:

    Also, why do you suggest that it be entered into a database?  Is this to protect it from public exposure?

    FUNCE:  Could you direct me to the page where you have implemented your model.  I am not sure that I understand it, and I would be loathe to reinventing the wheel , if it were not necessary.

    The most information you'll be able to gather from my page, is that it updates every 5 minutes, is slow to load the first time, and works nearly instantly from thereafter until the next 5 minute rotation. Here's the link: https://www.championfreight.co.nz/currency (It has a note on when it was last updated)

    The slow loads are updating the Database with the API, then displaying the data. The fast page loads are loading from the Database without updating, as the Data hasn't aged enough for me to need to update from the API.

     

    A very high level overview:
    RAM vs Disk. Disk is slow, and updates the RAM. The RAM is fast, and can respond to multiple commands quickly, as it can access its own data very quickly, but would need to update from the Disk if it gets a request it isn't expecting, and lacks the data required.
    In this scenario: Your Matomo would be the Disk, with the absolute values required at any time. The RAM would be a database you create and host on your own server. Its super fast, due to it being hosted in the same place, but periodically needs to get the up to date values from Matomo.

     

    I store a timestamp with the values I retrieve, so I check the timestamp, and if its too old, I get new values.

    In your case:

    • AJAX asks for Data from PHP
    • PHP gets Data from Database and checks when it was received
    • If its recent enough, PHP returns the data back to AJAX,
    • If its not, PHP asks Matomo for the Data
    • Matomo reports and returns the Data to PHP
    • PHP updates Database with Data, and a timestamp for checking later
    • PHP then returns the Data back to AJAX

    If you don't like the idea of a slow load, if your hosting provider allows scheduled tasks, just run the page on the scheduler. The page load from the Scheduler will pull all the Data required, and none of your users will experience any slowdown of experience.

    • Thanks 1
  11. 42 minutes ago, dsonesuk said:

    Yes! you can take only the data you want, then store it in database table or xml file, then access that directly, instead from Matomo.

    I've created this implementation with a Currency API that has very stringent limits. I managed to get it, so even if someone was always using the page that needed the API data, it would never go over. By reusing the old data with a data age check. (By storing what time the data was saved)

    AJAX call into 'controller' which then checks the Database, to see how old the data is. If its new, I get the data from the Database and return it. If its old, I get the data from the API, update the database and return the information. It works quite well.

    It also makes 'subsequent' calls to the 'controller' lightning fast.

×
×
  • Create New...