Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. You should use sessionStorage or cookie to record when they select one of the buttons, and on page load you need to check which button should be selected and run the associated Javascript that would run when they select the button. The browser may keep the selection on the form control, but it's not going to automatically run the click event again on refresh.
  2. That code doesn't really do anything other than wait for the page to load, or specifically wait for window load event, and then it runs that pageTransition function, whatever that does. I'm assuming that all that happens is that it waits for the load event and then adds and removes some CSS classes. If you're worried about those classes used for other things you just need to search through all of the Javascript code to see what else is using it.
  3. It looks like all it does is wait for the page to finish loading, and then it adds a class to the preloader div. If you remove the preloader div then you should see the page loading normally. It's just an overlay to hide the rest of the page while everything is downloading and rendering.
  4. There are event handlers to detect play and pause, if that's what you mean by turning the stream on or off. https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
  5. I'm not clear on why you're using the loader or what you're doing to remove it.
  6. What's the purpose of that Javascript code, what are you doing there and why? You should processing all of the submitted data in PHP, not Javascript. In PHP, don't make the brackets part of the name. It will already be an array. It's just $_POST['chkboxGrp0'].
  7. What does "active" mean, are you trying to determine if it's currently being played? There are event handlers for play, pause, etc that you can use to handle any events as they happen.
  8. You probably need to show some code. If you're talking about attributes, you use the name attribute to tell the browser how to submit a form. That doesn't have anything to do with Javascript.
  9. Set $this->con. Declare it with the rest of the properties as private, public, or protected.
  10. This reminds me of whatever reason of this scene: https://www.youtube.com/watch?v=G67eMq1YwmI Like Occam tried to explain, often the simple answer is correct. If a function is not defined in your environment, and it was introduced in a certain version, and you assume you're using that version, then your assumption is probably wrong. It's not a question of other code doing something mysterious, it's just the wrong version. And, like you've learned, don't assume that something you see in one environment (a console shell) is the same as in another environment (a web server).
  11. Just to be clear - if you had posted the initial error message and that line of code, the issue with PHP 7 would have been pointed out then and you would not have spent all of the time changing code until finding a function that was only introduced in PHP 7.
  12. How do you reconcile that with the admission that you're not a professional programmer? You'll say that you're not a professional programmer, but then you'll download a project, see some error messages, and assume that it's a bunch of broken code that you need to fix. Why is that the assumption you make, why isn't the assumption that the code isn't being executed correctly for whatever reason? One of the most important things I learned throughout school was how to do research. I understand programming theory in general, but I don't try to memorize all of the details of every language. When I run into something that I don't recognize or don't understand it's about doing research to figure things out. Programmers learn pretty quickly that assumptions are probably one of the biggest sources of errors. During the initial computer science courses when I tried to complete an assignment in C but it wasn't working, 100% of the time I would eventually figure out my problem and get it fixed, and I learned the process to debug. It starts by not making assumptions, and verifying everything. With every bug, I would find out that one of the variables or something wasn't what I assumed it was, and then it was just working backwards to find the source. I guess I'm saying that the answers are out there. Just because it doesn't make sense to you, doesn't mean it doesn't make sense. Keep in mind that you, or anyone else, don't know everything, we're always learning. Not only that, but programming language grammars are always changing, things are getting added or removed. Just be careful about the assumptions you're making with programming because incorrect assumptions can waste a lot of time.
  13. Yeah, you need to correct the version number. The solution to this issue is not to change any code. In fact, it is hardly ever the solution when you download a popular package and then find yourself needing to change a bunch of their code. If you ever find yourself in that solution, stop and consider the problem. Determine what assumptions you're making and test them. How did you know how to change that line? Did you look up the operator?
  14. I'm curious about your statement about removing extraneous code. What would you do in that particular situation? Deleting one question mark wouldn't be enough, I'm curious about what you decided to do. If you had searched for something like "php ?? operator" then you would have gotten results indicating that it was added in PHP 7, and that should have been enough for you. You could also have seen that the equivalent line would be this: $this->addressEncoder = !empty($addressEncoder) ? $addressEncoder : new Swift_AddressEncoder_IdnAddressEncoder(); That's how you would convert that line to the PHP 5 equivalent, but in order to know that you would have needed to look up what that operator does, and if you did that then you would have learned that it was only available in PHP 7. But, if you didn't do that, and you replace that line with anything other than the above, then you would have broken the software, it wouldn't have been doing what it needed to do (without errors or warnings, anyway). So I'm curious what your solution to that error would have been.
  15. I may be wrong, but I don't know if composer has the capability of determining whether an installed version of PHP meets a package's minimum requirements for the PHP version. It would be up to you to verify that. Even if it does have that capability, you have already demonstrated that you are running version 7.x in your shell, which is what composer would check. And again, don't assume that PHP running in a shell (especially on a cPanel server) is the same version that you're running in the web server. We run multiple cPanel servers, and I can set any version to work on the shell and any version to work on any account, independently. Don't assume, verify. You do that by creating a web page to tell you what's going on and running it through the web server. The line of code you are showing uses the null coalesce operator, which naturally was added in PHP 7. You are getting a syntax error because your version of PHP does not recognize that a question mark can follow another question mark. That grammar rule was added with the new operator in PHP 7. PHP 7 adds so many new syntax items that you can expect a lot of syntax errors if you try to get an earlier version of PHP to interpret code that targets PHP 7. The spaceship operator (<=>) and the Elvis operator (?:) are other ones that come to mind, if you write code with "<=>" in it, PHP 5 is going to tell you it's a syntax error. PHP 7 does not. There's nothing defective about the code. Not only is that a valid operator in PHP 7, but that's exactly the case where you would see it used. No one is sabotaging any projects, no one is trying to make things confusing for non-professionals. They are just targeting the most recent version of PHP, and considering the improvements that were made to PHP 7, I don't blame them. The solution isn't to blame the project developers or get snarky with the people trying to help you, just understand the environment you're using and the requirements for what you're downloading. Ingolme was right - the only blame for this issue is on your end for not understanding your own environment. If you find yourself needing to rewrite large pieces of a popular piece of software, you should ask yourself why. The answer is almost never because they have released broken software that everyone else manages to still use somehow.
  16. That's kind of a strange setup, to use middleware like that when it's not necessary. Cron can (and does) send things directly to the mail server (assuming there is a local mail exchanger). If any of my cron jobs send output, I get that emailed to me. PHP is not used in that process, I'm not sure why your server adds it. What both pieces? Swiftmailer and what else? What's your basis for that statement? There are many functional changes in PHP 7, why would changing the version have no effect on how the code runs (if there were no changes, why would there be a newer version)? You're asserting that Swiftmailer contains "defective" code, why are you making that assertion? It seems like a fairly mature project, so why are you assuming that a mature project contains "defective" code? What code are you specifically talking about? The library is here, identify the "defective" code by file and line number and tell me why you think it's "defective." Note also the description of the project: The only thing that you should be compelled to do is run that in the environment for which it was designed. If you need to remove any code at all, there's something wrong on your end. Consider that the vast majority of users do not need to alter or remove any code. This is not to say the project has no bugs or issues, I'm just trying to point out that any software project worth any weight will not release a version that simply doesn't work. There is no reason to do so, you keep working until you can at least release something that works.
  17. Note that cPanel servers can and do run multiple PHP versions.
  18. You have successfully determined the version number of the version of PHP that runs in your shell on that server. Now to determine the version that is configured with the web server.
  19. It should be pretty easy to test that: <?php ini_set('display_errors', 1); error_reporting(E_ALL); echo 'PHP version ' . PHP_VERSION . ', getting random bytes: '; $bytes = random_bytes(8); echo 'Got ' . strlen($bytes) . ' bytes';
  20. If it says the function is undefined, it's trying to execute the function and it's not defined. That's all there is to it. There is no code that you can put before that which would delete the function so that it's no longer defined. While it's possible to disable specific functions in PHP, there is no reason why a cryptographic random number generator would ever be disabled. The problem is your version of PHP. If you were running PHP 7 then that function would be defined. That's about as simple as it gets, there's not much mystery here.
  21. Nevermind, it looks like only "values" is reserved. But saying that your code doesn't work isn't enough to go on, what specifically happens? Are there error messages?
  22. Value is a reserved word. Did you really name your column "value?" If you choose reserved words for your identifier names then you need to escape them anywhere you use them.
  23. No, changing that variable does not change any other variables. You need to do that yourself. You should probably just use a loop to loop through however many pictures you have. The first step is getting all of the relevant elements for that picture.
  24. You're trying to use a property called $con in your class, but it doesn't have a property. Define the property and then set it in the constructor. You're only setting a local variable called $con, you need to use a property.
×
×
  • Create New...