Jump to content

maxxd

Gurus
  • Posts

    1,655
  • Joined

  • Last visited

  • Days Won

    51

Everything posted by maxxd

  1. None of what you've given us makes sense given what you say the problem is. Assuming the line of code you say you're using: let searchParams = new URLSearchParams(window.location.search); var status = searchParams.get('source'); actually is in your code - it doesn't appear in any of the code you posted - you still don't send the variable 'status' (which theoretically includes the value of the URL parameter 'source', not 'status' as the variable name implies) to $site_url()/reports/loadLeads. Also, you need to send an AJAX call to a php script (that ends in .php) and from there you can call a function - you can't call the actual php function from the URL string. And even if it did work that way, your loadLeads() method only accepts one parameter (which, admittedly, it doesn't seem to actually use), but your JS data object contains two. There's more beyond this, but quite honestly you need to take a step back and pick up some basics. Learn to walk before you run - I remember learning AJAX back in the day and it made no sense whatsoever until I'd done enough base-level work to actually get it. The penny dropped and it hasn't been a problem since.
  2. There's no AJAX calls in the code you've posted. If you think the error is there, perhaps post it for us to take a look. If you're using the index method for your AJAX calls (again, we don't know as we can't see the call) then it could be that it's borking because you're trying to render the entire template file instead of returning the pertinent data from the query.
  3. What is redirect_m? I don't recall it from codeigniter and don't see any references to it in the docs. You're treating it like a db abstraction layer which is confusing given the name.
  4. So Barand did all the work and made a useful working script under the impression he was not only helping you with a personal project but helping someone who wanted to learn PHP. You then removed all public-facing attribution to Barand and broke the system, turned around and tried to sell the software he built and you broke, and now you offer him a 50-50 split but you can't understand why he's miffed about it? I mean, dude...
  5. @Barand I've always thought you were too kind by half; I guess no good deed goes unpunished, eh? OK, given the history I'm out. Enjoy, Leon.
  6. That's a ton of code - does it work? Does it throw an error? What does it do, and what is it supposed to do?
  7. As an aside, please use the code button in the post composer to paste code (it's between the quotes and the smiley face - "<>"). It helps with formatting and as long as you select PHP in the language drop-down on the right, it'll color-code your code and make it much easier to read.
  8. You won't necessarily be able to see the whitespace - depending on what IDE and character set you're using there may be an errant byte order mark in the output or there may just be too many includes to thoroughly trace. And just because you deleted opening/closing PHP tags in header.php doesn't necessarily mean that's it. For instance, you have a couple open/close tags in login.php and you don't show the full code of marina.php. Basically, if you have unbroken blocks of PHP, don't break up the blocks. There's no need to go in and out of PHP unless you absolutely have to, and nine out of ten times you don't. Unless you're using WordPress or an old-style or homegrown framework, in which case you will have to so be aware that it's not a great way to develop and keep a close eye on your code.
  9. Stop going in and out of PHP for no reason. In the header.php file you have whitespace before you call header_start() (it's the blank line between ?> and <?php) - you can't have output before you start a session. I'm assuming that's the error you're getting because that's a lot of strangely formatted code to go through and it's been a bit of a long day.
  10. Have you updated your Yoast plugin recently? Try deactivating it and see what happens.
  11. I'm not versed in CSS frameworks for personal reasons, but is the w3-css you're talking about actually associated with w3schools.com? If it is, given the quality of the rest of the content I've seen on that site drop it immediately and move on to something else.
  12. If I'm not mistaken you can schedule posts to be published at a specific time in WP. Are you sure you're not over-engineering the solution?
  13. If you echo plugin_dir_url(__FILE__); it wouldn't include 'style.css' - you didn't ask it to. However, if that output shows the correct path (including trailing slash) that leads to your styles.css everything should be working. I'd turn on error reporting in your wp-config.php file (and local dev environment) and check your logs. Another thing to check is that your css selectors are correct.
  14. Using wp_enqueue_style is the WP 'best practice' for getting your stylesheet into the WP templates, assuming your theme calls header() at some appropriate place. If you're still not seeing your changes, check your developers tools for 404s and inspect the source code - is your stylesheet actually found and included in the markup?
  15. Not sure what the test() function is for, but your wpse_load_plugins_css() function is technically correct. I'd recommend making the handle more specific than 'style', and make sure your stylesheet is actually in the main plugin directory and not a sub-directory like `wp-content/plugins/myplugin/css/style.css`.
  16. Also, creating the DateTimeImmutable object within the constructor couples the SomeClass with DateTimeImmutable. If you decide at a later date to switch from plain PHP to Carbon (for instance), you've got a ton of code to change. That's pretty much antithetical to dependency injection which - as I understand it - is the entire point of property promotion.
  17. A more efficient way is to only select the 8 rows you're looking for instead of selecting the entire table.
  18. In the commented out version, $column is between $where and $rule. So, when you use the second block of code on the commented-out version of get(), 'OREDER BY RAND()' becomes $column and $rule is blank.
  19. Show the action() method please. I've said it before and I get the idea that I'm yelling at the storm, but you're making your life much more complicated and harder with the DB abstraction you are creating.
  20. If you're looking for the categories, select the category column and save yourself the trouble. $qry = " SELECT category FROM categories; "; $cats = $conn->query($qry, PDO::FETCH_ASSOC); Selecting '*' is inefficient in general from a SQL standpoint, and you're bound to keep running into the complexities you're seeing now. Select what you need in the mode you need it.
  21. Excel sometimes has issues with character encoding in it's CSV export - I ran into this just the other week. You'll need to scrub your input before you can actually use it.
  22. I'm waiting for my WSL distro to switch from v1 to v2, so here's a little bit: #2 - $icon_img is a boolean, not an array. I'm not sure what ct_get_image_by_size() does, but it's probable something went wrong with it. #3 - See #2 #4a - Probably related to #2 #4b- Definitely related to #2.
  23. That's going to put all the header values in the same option. You need to create a new option element on each iteration of the loop.
  24. PHP 8 requires parentheses when using nested ternary operations - https://lindevs.com/nested-ternary-operators-requires-explicit-parentheses-in-php-8-0/.
×
×
  • 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.