Jump to content

matfish

Members
  • Posts

    242
  • Joined

  • Last visited

Posts posted by matfish

  1. function SortByDate($a, $b) {
            if ($a['pubDate'] == $b['pubDate']) return 0;
            return ($a['pubDate'] > $b['pubDate']) ? -1 : 1;
        }

     

    usort($array, "SortByDate");
    foreach ($array as $item) {
    //blah blah... output
    
    }

     

    the above seems to work. Are you using last RSS?

  2. Hi, Thanks for the link.

     

    If I was confident enough with javascript I would have figured it out by now. Its not exactly overcoming the problem that when Iv selected the date, I need to calculate the age from a dd-mm-yyyy format (if I could explosed the date like I would in php I wouldnt have an issue).

     

    Any ideas? Take a date from dd-mm-yyyy in an input box and explode it to format: displayage(yyyy, mm dd, "years", 0, "rounddown")

     

    ?

  3. Hey,

     

    Iv got a load of javascript functions in a .js file, but Iv had to manually hardcode each URL. I would like to put a variable like "dir" so I can use like a global directory:

     

    function hide(which){
    element =	document.getElementById(which);
    anchr = document.getElementById('a_'+which);
    img = document.getElementById('i_'+which);
    element.style.display = 'none';
    anchr.href = 'javascript:show(\''+which+'\')';
    img.src = '/foldername/image_assets/expand.gif';
    }

     

    For example: the above; so that /foldername/ could be specified at the top of the .js file and would inherit throughout all the functions? Oh - trying without to pass a new variable through the function?

     

    Anyone? Please? Thanks ;)

  4. function BadWordFilter($text)
    {
    $bads = array (
    	array("ass","a*s"),
    	array("piss","p**s"),
    	array("crap","c**p")
    );
    
    	for($i=0;$i<sizeof($bads);$i++) {
    		$text = eregi_replace($bads[$i][0],$bads[$i][1],$text);
    	}
    	return $text;
    }

     

    The above woks ok, just wondering if reading from the txt file is quicker or via an array?

  5. Hey, thanks - seems to work fine and doesn't interfere with the speed of display (which is what i was worried about)

     

    seems to work only with words that match (case sensitive) - meaning: buGGer is not the same as bugger which is in the list.. any ideas?

     

    Thanks again

     

  6. Hey,

     

    got a comment/blog type thingy and in the users preferences they have the option to turn a bad language filter on/off.

     

    Im just wondering the quickest way to implement this to view the output? You think put the words into an array and if the word filter is true, then how would i go through all the array of bad words and replace with *** and would this be quick or would it delay viewing the output?

     

    Many thanks

  7. Think I understand where your comming from now..

     

    Iv got a form, which is repeated in a loop. If I press submit on the first one, javascript validates it (getelementbyid) which it highlights the box, I would then need id=title1 as this is the first form. Wouldnt both forms light up if I getelementbyid id=title ? withour any ID's after it?

     

    Many thanks.

     

    ps: I think i know what you mean now, as it will use the form id/name to get id=title ? and wouldnt need the number after it?

     

     

  8. Hey, this is more of a CSS issue and I will post elsewhere, but just wondering as its along the lines of validation.

     

    I have:

     

    <style type="text/css">

    #comment_error<?=$slap_detail['slapID']?> {float:left; color:#FFFFFF; padding:2px 2px 2px 2px;  margin-top:2px; width:226px; border:1px #000099 solid; }

    .comment_error_msg<?=$slap_detail['slapID']?> { width:223px; border:0px #003366 solid; background-color:#458CCC; padding-left:3px; border:1px #FF0000 solid; color:#FFFFFF;}

    </style>

     

    which is in a loop as depending on where the error is, is dependant on the id. This works, but the html validator says I cant put this outside of the head tag. Is there anyway of looping in a css document or shall i just repeat the query in the head which will output the css first?

  9. Hey thanks for the replies.

     

    lower-casing the mouseovers/onclicks worked thanks.

     

    I have a form which is being repeated (using edit in place with Ajax) so when I press submit, it takes the form_name[id] and then gets the id=title and id=body of that form for validation before posting but these are the things that are being repeated.

     

    I will re-check my coding as I understand id's have to be unque now - may have a work around.

     

    Thanks again.

     

  10. Also: Iv got:

     

    <input type="image" src="/images/cancel.jpg" name="cancel" id="cancel" value="Cancel" onClick="Javascript:window.close();" />

     

    Line 159 column 132: there is no attribute "onClick".

     

    So how would i close the window with a button otherwise?

     

     

  11. Not sure if this is the right place to post, so I apologise in advance.

     

    Iv been using: http://validator.w3.org to validate my HTML (HTML but im using php...)

     

    Its throwing a wobbley because the id="title" of an input box has the same id as another, but this is because its in a php loop. I cant put a numeric variable on the end of it like: id="title1" id="title2" from the loop as Im using AJAX to pick up these values for posting.

     

    Any ideas?

     

    On another note, I have an <a href tag with onmouseover and onlick - but its saying this is an error too - but dont understand why?

     

    Im very sloppycode, so any understanding of this would be appreciated.

  12. Hey,

     

    Coding in css & loadsa div's - got boxes etc.. like a sort of blog with comments/posted by and posted date.

     

    Firefox and IE7 works fine - however in IE6 it repeats part of the "posted by" div. So the layout is fine, but then you have a random few characters from another div printed directly underneath.

     

    Bit hard to explain...  Anyone know what Im going on about? Bit like:

     

    <div1>

    Comments go here

    <div2>posted date: 2007-02-02</div2><div3>Posted by: matfish</div3>

    </div1>

    by: matfish <- this being the repeated text from div3 above

     

     

     

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