-
Posts
1,698 -
Joined
-
Last visited
-
Days Won
53
Everything posted by maxxd
-
Try adding this to your CSS: .admin-influencers-tile-container::after{ content: ' '; display: flex; flex-direction: row; flex-grow: 1; flex-shrink: 1; }
-
How do you sync PHP code with Social Media, to show 'followers'?
maxxd replied to simona6's topic in PHP Coding Help
https://developer.twitter.com/en/docs https://developers.facebook.com/ All the major social media outlets have API documentation available, and all the ones I've ever had to deal with had PHP integration libraries freely available on GitHub or their respective developer sites - Google it and you should be on your way. -
Is $_GET['add'] set for the button(s) in question? The code you've posted will only run when vendor data is inserted into your database - does this happen on every page or every time a user clicks a button? What does your form code look like?
-
It depends - can people have more than one occupation and/or title in your system? If so, create a couple junction tables for that data. Other than that I'd consider splitting name into first and last just to make searching easier, but the rest looks fine.
-
In the name of all that you find holy, please don't do that.
-
The portion of your last code bit in parenthesis is called a ternary operator. I recommend reading up on it as it's something you'll see often if my experience is at all typical.
-
Href - use id of href & concatenation inside loop.
maxxd replied to JonnyDriller's topic in PHP Coding Help
CSS is for styling, not content. Though you have some limited ability to inject content via CSS, I'm 99.9% sure you can't control an href attribute from CSS. To elaborate on Barand's response to this, PHP will only interpolate variables in double-quoted strings. For instance, $var = "you"; echo "Hi there, $var!"; This will output Hi there, you! However, $var = "you"; echo 'Hi there, $var!'; This will output Hi there, $var! It's an important distinction. What? <?php opens a PHP block, and ?> closes it. So OK, technically you're on the right track; however if you just type <? into HTML, you're going to get <? on your screen. -
PHP doesn't see data-* attributes. However, you can grab the values using JavaScript and AJAX them to the server if you want. Barand's way is far easier, though. That being said, assuming you're outputting the form wouldn't you already have the values for the data-* attributes? Or are you trying to associate input data with a kind of metadata? It's very possible I'm just not clear on what you're trying to accomplish.
-
I don't think you're using the right index for the foreach(). Loop through $data itself, then get the value of ['Records']['Record'] of the current iteration. What you're doing right now is looping through $data[0]['Records']['Record'] - first off, you're specifically telling the program to loop through only the first index of $data, then you're telling it to loop only through the ['Records']['Record'] index of that first index. That may be correct (it's difficult to tell without seeing the data source) but it sounds off.
-
This is a WordPress plugin, and given what you're said about your experience I assume it's not code you wrote. It looks very similar to https://github.com/wp-plugins/product-sales-report-for-woocommerce/blob/master/hm-product-sales-report.php, which looks like it was last updated about 5 years ago. My guess is either the author decided to make the plugin commercial and took it off the public repository or it's a very similar, paid version of the plugin in the public repository. Either way, the plugin author should be accessible and if the plugin isn't working as intended that would be your first avenue to figure out why. If the plugin hasn't been updated in 5 or more years, then I'd reconsider using that particular plugin. At the same point, this is WC so I'd be shocked if there wasn't an actively maintained plugin that does the same thing. All that having been said, if you're trying to learn PHP I really can't recommend enough finding a different way to do it. WordPress is fine for a lot of things, and in some ways I think it's better than its reputation. However, it's not a good example of how to code PHP. It's very easy to do very bad things that still "work" when programming WordPress plugins and themes, and the code code itself oftentimes encourages bad practices.
-
OK - sorry if I came off harsh; didn't mean to be and that wasn't clear to me from your posts. In that case, go with whichever is more familiar to and comfortable for you. Personally, I use PHP if and when the option is available, but that's probably because I'm more familiar with PHP than JavaScript. That being said, whichever language is best for you to use, do what requinix suggests.
-
If you're using PHP how did this post get into the JavaScript forum? If you're dealing with PHP then yes, just use native PHP cookie functions. If you're using JavaScript, either use the library I linked to or the native functions detailed on the page requinix linked to. Either way, don't muddy the waters by involving a second language when either of the other two are perfectly capable of handling the problem.
-
Are you using product variations? If I'm remembering correctly what you're trying to achieve is exactly what that functionality is for.
-
I've used js-cookie in the past and liked it quite a lot. It's very straightforward and seems to just work. I've only used it with the noConflict() method so I can't talk to any global namespace conflicts, though.
-
Parse error : syntax error, unexpected T_STRING
maxxd replied to deltamike's topic in PHP Coding Help
The quotation marks in your sting aren't properly escaped. See https://www.php.net/manual/en/language.types.string.php for more details. -
Custom PHP question - Help please! :)
maxxd replied to iNeedPHPCodingHelp's topic in PHP Coding Help
Note that "$get_the_title()" is not the same as "get_the_title()". -
Custom PHP question - Help please! :)
maxxd replied to iNeedPHPCodingHelp's topic in PHP Coding Help
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. -
@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.
-
Somehow I'd forgotten about Symfony - thanks, @kicken!
-
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!
-
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?
-
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.
-
Quick update - this appears to get me the data I need - thank you @Barand!
-
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.
-
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!