Jump to content
#StayAtHome ×

maxxd

Gurus
  • Content Count

    1,076
  • Joined

  • Last visited

  • Days Won

    25

Everything posted by maxxd

  1. The quotation marks in your sting aren't properly escaped. See https://www.php.net/manual/en/language.types.string.php for more details.
  2. Note that "$get_the_title()" is not the same as "get_the_title()".
  3. And that code is exactly why I hated working with WordPress themes. Anyway, replace the 4 instances of $site_title with get_the_title() That should do the trick for you.
  4. @requinix - I too hate the "magic" aspects of Laravel. I really don't think it should take hours to figure out where data is coming from... @gizmola - Thank you for taking the time to write all that out! I'm planning on doing some more research this weekend and will definitely keep your post in mind as I do. Admittedly I like Twig and Doctrine myself, so I'm definitely gonna take some time going through those git repositories as well.
  5. Somehow I'd forgotten about Symfony - thanks, @kicken!
  6. Hey y'all. I'm doing some research right now and wanted to see if anybody has personal experience or opinions they're willing to share. I'm not looking for anyone to try to tell me which is definitively the best framework. My company is looking to migrate our application to a remote RESTful API to support about a thousand (for now) installations across several continents. I've been asked to look into what we want to use to do that. The choices on the table right now are CodeIgniter 4, Lumen by Laravel, and Slim. Personally I'm leaning toward CI4 at the moment as I like the updates they've made to the framework as a whole - it actually feels like a modern framework now, it's got fairly robust functionality without being overly opinionated, and it's zippy from what I've seen. However, it doesn't come with authorization out of the box, so that'll have to be home-grown. I'm leery of Lumen because... well, fair or not, it's a Laravel product and I have some qualms with Laravel - it's the overly opinionated thing, mostly. Slim I don't know terribly well (I played with it a bit a year or so ago) - it looks nice, but seems like it's pretty much just a router and we'd have to create all the CRUD functionality and whatnot all over again. All of that being said, really nothing's off the table at the moment and I can see pros and cons for each of them. Which is why I'm asking here - any stories to share? Pain point, pleasant surprises, things you can't live without (or with)? Thanks in advance!
  7. 500 status is a server error. If you click on the error row in the Network tab in your developers tools and then click the 'Response' tab in the popout, it should show an error of some sort. Or at least some output - what does that say?
  8. You'll need the Facebook PHP API. Once you figure it out, it's not too bad to use as I remember. Admittedly, I haven't used it in a long time, and I will say I hope the documentation has gotten better because it seriously sucked when I used it.
  9. Quick update - this appears to get me the data I need - thank you @Barand!
  10. I don't mean to sound like an ass by saying this, but that is adorable. With the current updates in esNext (whatever year it's on now) you can seriously cut down on the number of lines of code you have to write, but you also seriously erode the readability of the code if you're not careful. Either way, with or without a framework, kicken's code is the least amount code you can expect to write - if you want it to do anything other than announce the fact that you've clicked something, it's going to take more thought - and code - from you.
  11. That's exactly what I was looking for out of the query - sorry for the late response, my internet connection is deeply inconsistent at the moment, because ... well, because Spectrum, apparently. But thank you so much for the help - I'll dig through your SQL tomorrow morning, apply it to my full situation and data set and let you know how it turns out. Thank you yet again, Barand!
  12. product_inventory has an FK (product_location_id) to product_locations, which includes both the location ID and the product ID. product_locations.stock is used only for the stock at the actual time of the transaction - product_inventory is for historical inventory reports. As far as loading the data, I've got seed files if that's something that'll help - I had always gotten the idea you were more straight PHP than framework, but I'd be happy to copy and paste if it'll help.
  13. Hi y'all. - I've been beating my forehead against this for a few hours now and though I'm sure it's something incredibly obvious and simple, I'm just not seeing the error. This is a historical inventory query - the data is as follows: product_inventory product_locations locations products OK - so that's my data setup. My query is this: SELECT p.productName ,p.productCode ,pi.current_inventory ,pi.transaction_date ,l.name FROM products p LEFT JOIN product_locations pl ON p.productCode = pl.product_id LEFT JOIN ( SELECT product_location_id ,transaction_date ,current_inventory FROM product_inventory WHERE transaction_date < '2020-01-03 23:59:59' ORDER BY transaction_date DESC LIMIT 0, 1 ) pi ON pl.id = pi.product_location_id LEFT JOIN locations l ON pl.location_id = l.id WHERE l.id = 1; And this is my result: Note that I'm not getting a value for either current_inventory or transaction_date for product S10_1949, despite there being 3 matched rows in product_inventory. Can somebody kick me in the head to knock the dust loose and help me figure this out?
  14. Set up a listener in a JavaScript file that's included in the HTML page. How this happens depends on what JavaScript framework or library you're using - if any, because that's different, too - but basically you want to set up a general onclick() listener for your element(s); give each clickable element (the <li> elements in your case) a unique selection attribute so you know specifically which one has been clicked. You can give them all different id attributes or use data-* attributes - whatever is easiest for you works, however I recommend being consistent so as to avoid confusion in the future.
  15. There's gotta be more info here - the log you shared doesn't indicate any kind of problem, and the image looks like a file is uploading. Post any error messages you're getting in the browser or the developer's tools (make sure you check the network tab).
  16. No, using CSS will definitely be better at accomplishing it. You're talking about responsive web design, which is not accomplished with PHP. Stop trying to use a bazooka to kill a gnat.
  17. There's no context around the code you've posted, but there appear to be a couple issues. First and foremost, you're using get_currentuserinfo() , which is deprecated in favor of wp_get_current_user(). Even beyond that, you're requesting the data of the currently logged in user, which is you. So actually your code is doing exactly what you've asked it to do. Another issue is that you're calling get_currentuserinfo() multiple times - if all this code is in the same template you don't need to do that. Give some context to what you're trying to do with this code. If you're in the WordPress loop, use the information about the current post.
  18. Thanks for the verification - it didn't make much sense that you would be able to hint on them given the way they're used, but I don't have a ton of experience with traits...
  19. I could be wrong, but I believe you can't type hint to a trait where obviously you can to a parent class. So depending on how you've got things set up and what exactly you're trying to do, that could be a consideration.
  20. If you're attempting to append data to the text file, you need to open the stream with 'a' or 'a+' mode - 'w' will truncate the file.
  21. Well, you could try your idea about checking to see if $_SESSION is set, or you could read the manual page I linked to and use session_status(). I personally like a front-loader style pattern, so when I'm not using a CMS or framework (which will usually handle sessions for you by doing exactly this) I typically turn on sessions in the initial loader file then forget about it.
  22. If you start all your php scripts with that, then you're attempting to start an already started session every time you use an include or require directive. Depending on the pattern you're using it may or may not be easy to make sure you only instantiate the session once, but you can always check to see if a session has been started before attempting to start another one.
  23. This issue is that the php files have functions that throw an error if there's any output before those functions are run, right? Wouldn't then the solution be to put any output after those functions are run? *Hint* The CSS link in your HTML is output.
  24. maxxd

    git question

    Actually that's exactly what we're doing right now - we open GitKraken and try to follow the graph. Don't get me wrong - it works, I just personally find it a bit frustrating. It's probably a moot point as we're looking into moving to a scrum process in the new year; so theoretically we should know at all times what's being worked on for the next release. However, I have to assume that scrum doesn't always work as advertised, and I can see the possibility of losing track if we have a single release that spans multiple scrums. Looking at it further though, I guess it's possible that creating pull requests from the feature branch(es) into master, then creating another pull request from master into production could give me the trail I'm looking for. At least I can see in GitLab the branches that were merged into master after the last merge from master into production... Just kinda wish there was an audit view on a branch to easily show any branches that have been merged into the current one.
  25. maxxd

    git question

    Kinda what I figured - thanks for the link!
×
×
  • 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.