Jump to content

maxxd

Gurus
  • Content Count

    898
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by maxxd

  1. Post your code here - not everyone trusts external links. In the meantime, looking at the code you've already posted, where does $filename come from?
  2. There probably won't be any errors in your console - everything's working fine on the client side. Check the Network tab - look for the ajax call to 'file.php', then see what the return is.
  3. According to the documentation, the success function will only run when the call succeeds - you need to check for errors using the error function. What does the network tab of your developer tools have to say?
  4. maxxd

    Strech to fit height...

    Don't feel bad, I've been doing this for 20 years pretty much straight through and I'm still playing catch-up. I've had some people scoff recently because I use Vagrant and Gulp and manually deploy WordPress sites to a server as opposed to Docker, Webpack, continuous integration, and automated deployment to a server-less AWS instance. What I'm saying is that this stuff moves hella fast.
  5. maxxd

    Strech to fit height...

    An auto-prefixer will add any necessary browser-specific prefixes to CSS rules during compile time. I use gulp-autoprefixer in my build flow right after I convert from .less to .css and concat all the files, but before I minify. My CSS task in my gulpfile looks like this: const aw = require('gulp-load-plugins')({ pattern: ['*'], scope: ['dependencies'] }); // .... other tasks aw.gulp.task('compileCSS', () => { "use strict"; return aw.gulp .src(theme.srcStyle) .pipe(aw.plumber(handleError)) .pipe(aw.less({ strictMath : 'on', strictUnits : 'on', })) .pipe(aw.concat('all.css')) .pipe(aw.autoprefixer({ browsers: [ "last 2 versions", "IE >= 10", ], grid: false, })) .pipe(aw.cssmin()) .pipe(aw.rename({ extname : '.css', basename : 'style' })) .pipe(aw.gulp.dest(theme.destCSS)); }); Note the `aw.autoprefixer` call - that's using the gulp-autoprefixer module and asking it to add any browser-specific prefixes necessary for all browsers up to 2 versions back from the current version of all modern browsers, as well as Internet Explorer 10 and 11. It also turns grid CSS support off because the support for grid in media queries is a bit spotty. At any rate, it allows me to type this: .wrapper{ display: flex; flex-direction: row; justify-content: space-between; align-items: flex-end; } And get this output: .wrapper{display:flex;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end} You can see how the flex-direction and justify-content browser-specific syntax for both IE10 and Safari 3.0 on iOS 1.0 are appended automatically. Obviously you'll get more rules as you change the values in the browsers array you pass into the autoprefixer call in your gulpfile. tl;dr - it saves you a lot of time thinking, Googling, and typing while doing it's best behind the scenes to make sure your site's CSS is consistent across as many browsers as possible. Totally random aside, but I'll probably start trying to use sourcemaps soon, which right now I don't due to the in-house development style at my job, because I'm currently trying to change that process.
  6. maxxd

    Strech to fit height...

    I'm not terribly versed in Bootstrap, but I can tell you that w3schools should be used as - at best - a place to find the terms you need to Google for the actual information. From what I can see from the documentation, Bootstrap's flexbox coverage looks pretty good, though it's always been the small, medium, large, and extra large designations that my brain doesn't deal well with. *edit* I'm not sure what kind of auto-prefixing Bootstrap does - I have to assume there's some as it's so widely used, but that may be a bit of a sticking point, especially with the mobile Samsung browser as it seems to have some idiosyncrasies of its own. Also, watch iOS Safari with flexbox as that can be a bit sticky if you're not using Babelify or another auto-prefixer (and sometimes even if you are - I've found it to do some strange things for no reliably reproduce-able reasons).
  7. maxxd

    Strech to fit height...

    Building on your other post, what are your target browsers? If you're not concerned with IE9 and are using an auto-prefixer (or don't mind typing a lot) you can use flexbox. A combination of flex-grow with justify-content and align-items can do exactly what you're looking for easily. If you're targeting more modern browsers (in other words, you don't mind skipping out on IE support entirely), you can use grid, though that could be more complicated depending on how your brain works. If you are dealing with much older browsers, use 100vh with positioning and transforms as @Barand suggests.
  8. maxxd

    Do I have the right idea here?

    Yeah, I also love me some Microsoft for most things. IE, however, still sucks in a major way. Edge is slightly better in my experience, but I'm still about Firefox and Chrome on Windows 10.
  9. maxxd

    Do I have the right idea here?

    Nothing at all wrong with using Modernizr. However, IE9 has (according to the Can I Use browser report) a 0.17% usage through 2018. navigator.cookieEnabled (please note it's cookieEnabled, not cookiesEnabled()) has full browser support according to MDN, even in IE - admittedly, no browser version is noted - and doesn't require an additional header call and/or download. Now, Modernizr's download footprint is small and well done, so it probably not that big a consideration in the long run. Either way, it's up to you and you gotta go with what you're comfortable with.
  10. maxxd

    Do I have the right idea here?

    Ooof. You're still supporting IE9? Government contract or sadistic manager? All kidding aside... ooof. We just recently dropped support for 10, but even that's a massive step up from 9.
  11. maxxd

    Do I have the right idea here?

    Instead of reinventing the wheel, use navigator.cookieEnabled. It looks like it's available across all browsers, and it's a lot less typing. If it returns false, pop up a modal telling the user they need to enable cookies. If it returns true, do whatever you need with cookies.
  12. maxxd

    Accessing uploaded file data

    What kind of data are you expecting to work with? PHP can work with image, text, JSON, XML, PDF, and many other types of data but it's all done differently. So, what are you actually trying to accomplish other than altering user-supplied data?
  13. maxxd

    classes, interfaces and methods

    There's that, too - plus I've been trying to bone up on my ESNext skills over the past month or so, so that's kinda where my head is right now.
  14. maxxd

    classes, interfaces and methods

    Yeah, it's correct but somehow it feels like JavaScript - it's probably because I forgot you don't use dollar signs on constants...
  15. maxxd

    classes, interfaces and methods

    Why are you stumped? You're not calling the methods. @Barand beat me to it, but here's another take on what he is saying. interface animal{ public function walk(); public function fly(); public function swim(); } class Cat implements animal{ public function walk(){ echo "Cat can walk"; } public function fly(){ echo "Cat no fly"; } public function swim(){ echo "Cat no like"; } } class Dog implements animal{ public function walk(){ echo "Dog loves walk!"; } public function fly(){ echo "Dog doesn't fly..."; } public function swim(){ echo "Dog LOVES swim!!!!!!!"; } } class Animals{ private $_animal; public function __construct(animal $animal){ $this->_animal = $animal; } public function display(){ $this->_animal->walk(); $this->_animal->fly(); $this->_animal->swim(); } } $cat = new Animals(new Cat()); $dog = new Animals(new Dog()); $cat->display(); $dog->display(); Also, it almost looks like you're mixing PHP and JavaScript - in PHP all variables are prepended with a dollar sign. And the use of const is possible in PHP, but the way you've used it here looks a bit more like JavaScript to me.
  16. maxxd

    php libraries

    MLS search functionality is (mostly) determined by the system serving the stream. If your client is using RETS, you can use PHPRets to interact with the database. If your client is using FlexMLS, you'll use the SparkAPI for PHP. Both are well documented and easy to use, though in my experience FlexMLS is significantly faster and offers more robust on-the-fly searching and sorting. Also note that even using one of these libraries, you'll have to write custom code to make it actually do anything. Some sites have a cron set up to use one of the APIs above to download the day's MLS listings to a local database each night, at which point the filter, sort, and search functionality is all yours to design and develop.
  17. maxxd

    Need help with password validation

    http://us1.php.net/manual/en/function.password-verify.php and http://us1.php.net/manual/en/function.password-hash.php
  18. The other obvious solution is to paginate results. Infinite loading is fine and all, but there are issues with it (as you're finding now) that don't happen with simple pagination. For instance, if the user has JavaScript turned off - admittedly not very likely, but possible - window.history and state won't do anything.
  19. maxxd

    Transfer JS data to PHP

    I'm not sure what you mean by "re-shaped", but yes technically you could grab the contents of any structural element via JavaScript and then send that content as data to PHP via AJAX. However, you're not saving yourself any "lines of code". In fact, you're adding complexity to what should be a fairly simple system, given what you've described. Perhaps you could explain what exactly you're trying to do and why you're determined to do it this way?
  20. maxxd

    Sending mail from multiple table

    Pretty much exactly what @Barand said.
  21. maxxd

    Sending mail from multiple table

    Yes if you're trying to send three different emails to three different groups then you're pretty much out of luck. Run three queries to get the recipient pool for each email. That having been said, even if that is the goal you can definitely save some resources by using PHPMailer instead of PHP's native mail() function. You can add multiple recipients with the AddAddress() method, so instead of trying to send an email on each iteration of the while() loop, you can instead create a single instance of PHPMailer, call AddAddress on each iteration through the loop of recipients, then send them all in one call. Also, PHPMailer is more reliable and far more robust than PHP's native mail() function (unless there's been some major work to the mail() function while I wasn't watching).
  22. maxxd

    Getting hacked

    Is there a question here other than the obvious "Is this a terrible idea?" (yes. yes it is.)?
  23. maxxd

    pulling from database

    In all the unformatted code you just posted (use the "<>" button next time), there's no PHP.
  24. Absolutely needs to be validated on the server side as well. My wording could have been better - thanks!
  25. Or JavaScript; check the value on submit - call an alert() can return false if it's empty, otherwise proceed as normal.
×

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.