Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by Irate

  1. Hello everyone, it's been a while since I last made a topic, but here we go.


    So, to start, I am working with TYPO3 right now - to be exact, I am modifying an extension for someone - and I want to assign certain variables I can access with placeholders, but I have not worked with SQL in a while and since I have been here for a while, I figured I might as well ask you guys.


    I am grabbing entries from the table brandings which has three columns: one is called "brandingTargetPath", the second one is called "user" and the last one is "when", where the first two will be varchar(255) and the last one is int(11), with the table having an auto-increment Primary Key called "uid".


    Now, I can select the rows I want to and use "SORT BY when DESC" to get the most recent entries first, but then I want to differentiate between the different "brandingTargetPath" entries and show only the most recent entry in a certain path (the possible paths will be provided by PHP).


    Could anyone just hint me at the direction which SQL commands I should use? That'd be great, I can sort out the rest by myself.


    Thanks in advance,



  2. Or just use regular expressions if you don't want to convert to lower-/upper-case and then back to the original state.


    You can't dynamically create regular expression literals, so you have to use the /* new */ RegExp() constructor (the new is actually optional as it will work the same either way).

  3. Just a quick suggestion (more like urging you to do it), use jQuery for anything even remotely related to Ajax. It makes everything a lot easier.


    If getkm.php works fine, then you might call it like this with jQuery: $.get('/getkm.php'{b:postcodebeginww,e:postcodeeindww},function(data){});

    In the function(data){} part you handle the response. You could use .done(function(data){}), too, whichever you prefer.

    And look uo the jQuery documentation in general.

  4. Ajax is just a scripted HTTP-Request "module" JavaScript contains. It does not provide anything else on its own, just, as I said, a way to asynchronously fire HTTP-Requests.


    In some cases, you just have to bite into the sour apple and not support IE beneath 10. It's not uncommon, actually.

    You could use Shockwave Flash to embed animations on IE, if you want to, though.

  5. Two things.


    1. If I see a huge block of code without any proper formatting (

    /* code here */

    helps a lot), I usually don't even start to bother reading all of it.


    2. You're already using jQuery which provides the most cross-browser comfort a JS framework has to offer. If it doesn't work with jQuery, it probably doesn't work at all in IE.

  6. The HTML comment works for all IE versions which are lte 8, where lte is "less than or equal".

    If you need a more general condition, use <!--[if IE]>...<![endif]-->.

    Other possible variants are lt IE n (where n is the version number), gt IE n, gte IE n and !IE (for NOT IE).


    Edit: Got my BBCode wrong.

  7. $("input[type='password']:eq(0)").on("change",function(){
    var next = $("input[type='password']:eq(1)");
    if(!next.val().trim()) return;
    if(next.val()==$(this).val()) // passwords match, do something
    var prev = $("input[type='password']:eq(0)");
    if(!prev.val().trim()) return;

    It's just an example of how to implement that. There's some other ways, too.

  8. Of course...

    There's a way to do that just with HTML, too (but it's disfavoured by the W3C, so use something else than HTML if you).


    <!--[if lte IE 8]><meta http-equiv="refresh" content="0; http://urlhere.com/file.htm"><![endif]-->
    And the version with JS.


    <!--[if lte IE 8]><script>window.location="http://urlhere.com/file.htm";</script><![endif]-->
  9. RegExp for the 2nd question would look like this...




    As for the RegExp you posted, you can use commonly used shortcuts, like [\w] instead of [a-zA-Z_-], I think that'd help you somewhat.


    Edit: Forgot a backslash.

  10. Well, it's by far easier with jQuery if you want to pass form information or something you can use .serialize(). You could use .serializeArray() to keep things easier and cleaner. It sounds like all you want to do is use window.location and set it to something like "http://mysite.com/?var=this&var2=that".


    You can say "screw jQuery", but the truth is that it makes just about everything so much easier.



    That is the main thing you should have paid attention to from his post. If you want help, you should put some effort into trying it and show us that you have. Just coming and asking for code isn't going to get you very far. There's a freelance section for that stuff.


    Also, no. You don't need jQuery for anything. It makes things a hell of a lot easier though, and a lot of times lets you do much less work for the same or better result. You don't need a lawn mower to cut your grass. Scissors work, but it would be a pain in the ass.

    Just to grab up the point of your last paragraph...

    jQuery makes everything easier, but if you're really, really, really (and I mean really) concerned about your page load and those few milliseconds it takes to load jQuery from Google APIs (or directly from code.jquery.com), then using vanilla JS is often the more straightforward approach (but nevertheless more verbose; it also doesn't provide very useful utility functions).

  11. You made a syntax error at Math.max(count-35;0) (bolded the mistake for you).

    Besides, checking the maximum out of any value and 0 is basically pointless unless you know for sure that you're going to use negative values...


    Oh, use Number.toFixed(d) where d is the amount of decimal spots you want to have (the function may round up or down if you're near to an integer value).


    Edit: looks like I forgot that the ic code prevents BBCode from being parsed. Hah.


    Also, all of this is pretty basic work which could easily be found in Google.

  • 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.