Jump to content

maxxd

Gurus
  • Content Count

    844
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by maxxd

  1. maxxd

    403 surprise

    If your host provides cpanel, try the Metrics > Errors log. That may point you in the right direction.
  2. Yes. Depending on how everything is set up and when and where the function is defined you may have to pass jQuery to the function, but it's easily doable. For instance (and please note it's late and this hasn't been tested so ... you know, look up the functions but the idea is solid) this: $('#mycontrol').on('click', function(e){ e.preventDefault(); $.post({ // ....etc etc... }); });
  3. OK - I've been beating my head against this for a bit now and I give up... I've got a vagrant box up and running on my host system. I'm using gulp with several node modules from the host system, and everything is working well except browser-sync. My directory structure (abbreviated): /dev /_assets /javascript /less /build /templates gulpfile.js package.json Here's the code so far: const _ = require('lodash'); const aw = require('gulp-load-plugins')({ pattern: ['*'], scope: ['existingDevDependencies'] }); aw.browserSync = require('browser-sync').create(); const pkg = require('./package.json'); var themeName = pkg.name.toLowerCase().replace(new RegExp(' ','g'), '-'); aw.gulp.task('Develop', ['browserSync', 'developJS', 'compileCSS', 'watch']); var theme = { srcJS : '_assets/javascript/**/*.js', srcCSS : '_assets/less/**/*.less', srcStyle : ['!_assets/less/variables.less', '_assets/less/style.less', '_assets/less/**/*.less'], destJS : pkg.directories.content + '/js', destCSS : pkg.directories.content + '/css', }; /** * Set up the browser reload on the host machine when the files are updated */ aw.gulp.task('browserSync', () => { aw.browserSync.init({ proxy: "vagrant.craft.internal", host: "vagrant.craft.internal", open: "external", port: 80, }); }); /** * Development JavaScript handling. * Browserify, Babelify, and uglify with in-line sourcemapping */ aw.gulp.task('developJS', () => { "use strict"; _.forEach(_.castArray(pkg.scripts.entry), (script) => { aw.browserify({ entries: ['./_assets/javascript/' + script + '.js'], debug: false }) .transform(aw.babelify, { compact: true, retainLines: false, comments: false, }) .bundle() .on('error', handleError) .pipe(aw.vinylSourceStream(script + '.min.js')) .pipe(aw.vinylBuffer()) .pipe(aw.uglify({ sourceMap: { url: 'inline' } })) .pipe(aw.gulp.dest(theme.destJS)); }); }); /** * During development, obviously we want the system to watch for any * important changed files and to handle those automatically. */ aw.gulp.task('watch', ['browserSync', 'developJS', 'compileCSS'], () => { "use strict"; aw.gulp.watch(theme.srcCSS, ['compileCSS', aw.browserSync.reload]); aw.gulp.watch(theme.srcJS, ['developJS', aw.browserSync.reload]); aw.gulp.watch('./build/templates/**/*.html', aw.browserSync.reload); }); /** * Production and Development .less processing * Processes the .less to CSS, then minifies the file. * Note that grid support is enabled and we're bablifying * back to IE10. This should change in the very near * future as we drop support for 10. */ 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: true })) .pipe(aw.cssmin()) .pipe(aw.rename({ extname : '.css', basename : 'style' })) .pipe(aw.gulp.dest(theme.destCSS)) .pipe(aw.browserSync.stream()); }); browserSync initializes just fine - my browser opens, loads http://vagrant.craft.internal and my terminal shows the proper Local, External, UI, and UI External addresses. I update my .less, .js, and .html files and my terminal says 'Reloading Browsers'. But there's no browser reload...
  4. maxxd

    issue with array_unique

    I'm totally confused - you say in the OP that a problem is that " it won't hide those previously refunded entries. ", but you need to see the previously refunded entries? I'm not getting it, so I'm gonna bow out in an attempt to lower the signal-to-noise ratio...
  5. maxxd

    issue with array_unique

    Chances are very good, yes. However, it's going to depend on how the tables are structured. I'm assuming there's a way to tell refunds from sales in your database - use that as your JOIN criteria. So, basically, when joined on transaction ID.
  6. maxxd

    issue with array_unique

    This sounds like a data gathering issue. I assume the data's coming from a database and includes a transaction ID and transaction type, yes? Would it be easier to pull transaction type sale without a corresponding refund transaction type - I'm sure there's additional business logic to be considered, but it seems to me it'd be easier than pulling everything and culling data you don't want from that.
  7. maxxd

    month/date with leading zero

    I'll admit, given that you could handle assigning a value to a variable and reading a value from a form element, I honestly just kinda assumed you'd be able to extrapolate assigning a variable value to a form element. Kicken's example should work for you - follow Barand's advice and tear it apart. As to the question of doing the data manipulation on the server-side, it depends on what you're doing and how you're comfortable doing it. The world is moving to a place where online applications act and feel like desktop applications, so getting comfortable with asynchronous functionality (AJAX and fetch) will serve you well in future development. However, if you're not familiar or comfortable with JavaScript (or any of the umpteen bazillion JS frameworks that are out there now) but feel good with PHP, do it on the server side. It'll get the job done and give you more time to explore other processes and solutions.
  8. maxxd

    month/date with leading zero

    I'll just leave this here again (I added the emphasis). You need to change the value of the field before you submit the form. Or follow kicken's suggestion to do the data modification on the server side in PHP. Or use the jQuery Datepicker widget and avoid all these issues you've been banging your head against for several days now.
  9. maxxd

    month/date with leading zero

    Again, are you setting the value of #birthday to the computed date before you submit the page? If not, the processing script will have 'birthday' in $_POST['birthday'] because your validation script doesn't change the value of the field.
  10. maxxd

    month/date with leading zero

    I'd give http://api.jqueryui.com/datepicker/#method-getDate a shot - it should at least put you on the right track for this. http://api.jqueryui.com/datepicker/#option-yearRange You're already running a complete page refresh on form submit, so I don't really see where this would become an issue for you. And again, you could format the date string in PHP before it's output to the page, thereby negating what appears to be a pain point for you.
  11. maxxd

    month/date with leading zero

    Legit. However, you can use jQuery's datepicker with drop-down month and year selectors to make this easier. To the question at hand, you say you're getting the date from a drop-down menu. How is that built? Seems to me it'd be easiest to add the leading zero on the value attribute (not necessarily the display text) during form compile rather than during validation and/or submission. As to your question about the validation, it depends on how you're submitting the data to the controller script. If you're submitting via AJAX from JavaScript, make sure you're passing the 'birthday' variable you've built in that snippet. If you're doing a full page refresh, assign the value of the 'birthday' variable to the hidden input before submitting the form - otherwise whatever script is processing the form data is getting the data from the hidden form field and not the JS variable.
  12. maxxd

    month/date with leading zero

    Is there a reason you're not using a datepicker? I know the jQuery DatePicker has formatting options and I have to assume other native/node/ESx datepickers do as well. It'd certainly be easier than prepending zeros to combobox values everywhere.
  13. maxxd

    Dealing With Windows 10 Display Settings

    I'm pretty sure - though I could be wrong - that rem and em take browser zoom into account, so if I'm right that could be another thing to look at. Although requinix is correct - the entire point is to make the font bigger. It can be pretty safely assumed that people that use the zoom functionality know they're messing with the designer/developer intent of a site and are OK with it. Kinda like turning off JavaScript in your browser - you do it and you pretty much forfeit the right to complain about site functionality (now days, anyway).
  14. You would simply pass the database query results (or portions thereof) to the function that outputs (or collates the data for) your form. It certainly doesn't need to be a global variable, unless I'm misunderstanding what you're asking. Post the code you're working with and we'll all have a better idea of what's going on.
  15. Add $mail->SMTPDebug = 2; before you try to send the mail. It'll give you a lot more detail as to the error that's happening.
  16. maxxd

    Height Of Contents Of Scrollable DIV

    .innerHeight() is working in tests here, unless I'm misunderstanding what it is you're wanting.
  17. maxxd

    looping through array buttons

    First and foremost, you've got some serious syntax issues, especially this line: list += '<li">'+this.id+' '+this.name</li>'; You see where your nested quotes are all over the place and you're missing the concatenation before the closing <li> tag? You'll need to correct that to begin with. Moving on from that, I'm not quite sure what you're trying to do. It sounds like you've got a list and want to select individual elements of that list using back and forward buttons? If I'm correct in that assumption, you'll want to build the list before you call your click() function. Personally, I'd build the list with 'data-index' and 'data-selected' attributes on each list item element. That way, when you click the next or previous button you can grab the data-index value of the data-selected="true" list item element, add or subtract one from it, target the list item element that has a matching data-index value and set it's data-selected attribute to "true". You'd obviously have to set the previous list item element's data-selected attribute to "false" at the same time. That way you really don't have to worry about keeping an index in the JavaScript.
  18. maxxd

    Problem with function

    Right. You assign the return value of the function to a variable. A more explicit version of ginerjm's example: $connection = is_connected(); echo $connection; See the difference in what you typed and your second block of code in your first post?
  19. maxxd

    Problem with function

    You're not assigning the returned value from is_connected() to $connection. You're just calling the function and expecting that $connection has been created elsewhere.
  20. He's talking about using this or this, and checking the documentation about how to do so. Yes, you should be able to set up SMTP via Gmail on both. I've not used Yahoo or Swift, to be honest, but I use PHPMailer on a regular basis and can tell you it's simple and it works much better than PHP's native mail() function.
  21. maxxd

    Regex huh?

    As someone who's really bad with RegEx, I've found this site very helpful while trying to figure out a pattern. Thanks to that, I've actually gotten my last couple regex's to work without having to bother people by posting it here.
  22. 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?
  23. 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.
  24. 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?
  25. 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.
×

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.