Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. What are the exact contents of config_data.excludes and item.title?
  2. I don't see how those two are related. Are you able to write a function that can copy just the files in a directory?
  3. /.../ is a RegExp. You only need to deal with the class if you want to create a regex from a string. And it's also not actually a function but a class, however you can invoke it like a function and get an instance in return. .test is a function on re, which is one of the regular expressions in the array. The whole point of Array.some is that it executes some function for every item in the array until it finds one that passes (the function returned truthy), in which case it returns true itself. "Are there some items in the array which meet some criteria?"
  4. Well there has to be a loop somewhere, question is whether you write it yourself or not. Array.some const regexes = [/a/, /b/, /c/, /d/, /e/]; const input = "something"; const any = regexes.some(re => re.test(input));
  5. Just writing "navbar.html" is a relative URL which means that where the URL actually goes depends on what page you're using it in. It'll always be in the current "directory", so to speak. And whether that URL is in a link or a stylesheet or some Javascript doesn't matter because they all work the same way. "../navbar.html" is also relative, except it means "go up a directory and then look for navbar.html". What you want is an absolute URL. It starts with a slash and always starts from the root of your website: "/navbar.html". Which isn't the right path, of course - apparently you need "/TestDash/navbar.html".
  6. Correct. That is what's throwing off the layout. Check your notification settings - specifically, "Change how the notification is sent".
  7. (psst I already know the answer) Don't worry about what "static" means. That's not the issue here. Look at your CSS rules. If you provide that position:static then that takes effect. If you don't provide that position:static then what else will take effect?
  8. // Store the result so we can check if the account exists in the database. $admin = mysqli_query($con, $stmt); Are you sure you want to do that?
  9. This has nothing to do with static and everything to do with CSS rules. Just because you have media queries in one place does not mean that rules defined elsewhere without media queries are never applied. So: what other CSS do you have being applied to things like .dropdowns?
  10. Yeah. Otherwise it's just a string.
  11. Do you have server and/or PHP error logs being recorded somewhere?
  12. Your site does not work by turning off errors. The problems are there and need to be fixed regardless of whether you can see error messages about it or not. The only thing that the PHP 8 upgrade did was change error display settings. These problems, like "trying to access array offset on value of type null" and "undefined variable", have been there for a while. You just didn't know about it until now. Frankly, "thousands of lines of code" is not that much. Each error message tells you where the problem is - all you have to do is go to the code on that line and, most likely, make a small change.
  13. I don't suppose you've tried investigating what error is causing the 500?
  14. What errors? What's not working? 7.4 to 8.0 wasn't a huge upgrade but there were a number of breaking changes...
  15. Have you tried asking your professor? Or a classmate? Because if this is related to some class work then it's going to be hard for us to know what it is you're expected to do...
  16. Forums are way better than StackOverflow for anything but the most trivial and straight-forward of questions. Forget trying to discuss anything on SO... Yes: the first one allows one and only one instance of the class, while the second allows anyone to create as many as they want. Which also means the first one's constructor should be private. Public could be okay but that means two paradigms for the class and that's one too many.
  17. sigh There's a lot you'll need to learn if you want to do this - more if you want to learn to do it correctly, and well. Start with just the basics of PHP and HTML: you'll need to write a fair amount of both to make a chat system.
  18. You're wondering how OpenClassrooms is able to work? Easy: Money.
  19. You could, you know, not install two different copies of PHP... XAMPP is a bundle with its own software. That's kinda the point of having it in the first place. Way I figure it, you either keep that bundle and run its PHP (first step: uninstalling the other one) or you keep the system one and switch Apache to run PHP scripts through it instead. I think I'll suggest keeping XAMPP because then you don't have to deal with server configuration. I don't know OSX particularly well but I'm sure you can somehow create a "php" alias pointing to the binary that came with XAMPP. Though you'll probably still have to deal with different CLI and web configurations, but at least that's mostly just copying or symlinking php.ini files.
  20. Is that a complicated way of asking about LIMIT?
  21. But what's to prevent us from having the same "deprecated stuff" problem in a couple years? What could we do to make the tutorial concept actually successful? I'm not just making these questions up: I worked on a site that had the exact same idea, and we even got some people to write a few, but writing them is hard so nobody wanted to keep making more and soon the ones that had been made previously fell out of date. It's a great idea on paper. It's a difficult idea in practice.
  22. What code have you tried so far, what did you expect to see it do, and what did it actually do?
  23. But who will write the tutorials? Who will keep them up to date? Does the internet really need another set of tutorials on a thing? It's a nice idea in theory but rather difficult in the practice...
  24. 1. Instead of doing lots of calculations everywhere, especially the same ones over and over again, use variables. 2. When you just want to echo something, use short open tags. 3. Clean up the code. For example, your "$total_pages" is not actually the total number of pages. And when you're comparing X+1 versus Y+1, having those two +1s is pointless. IMO the basic style you have there, where you have some PHP code in the markup but it's just outputs and simple conditions, is fine - it's simply messy. Like this <?php if ($page+1 < ceil($total_pages / $num_results_on_page)+1): ?><li class="page"><a href="pagination.php?page=<?php echo $page+1 ?>"><?php echo $page+1 ?></a></li><?php endif; ?> isn't as easy to read as this <?php if ($page < $total_pages): ?><li class="page"><a href="pagination.php?page=<?= $nextpage ?>"><?= $nextpage ?></a></li><?php endif; ?> but you can make it look even cleaner by separating the HTML and the PHP even more, like <?php if ($page < $total_pages): ?> <li class="page"><a href="pagination.php?page=<?= $nextpage ?>"><?= $nextpage ?></a></li> <?php endif; ?>
  25. "High traffic" as in being written to frequently? Then you have a small problem of trying to decide what rows in the table you want to archive - after all, a bunch of them are being added all the time. Or, if it's being read from frequently, how are you going to make sure you don't pulls rows out of the table when something wants to read them? I feel like you have some questions here that need to be answered before you can do much more...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.