Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. you can wrap it in <pre>...</pre> tags or replace each space with "& nbsp;" (no space) this is not a php question. moved.
  2. Dude you would totally be in the right to argue that it is a significant inconvenience to you. They already lost your shit once. Now they are saying it's going to take a month to repair. That's bullshit. There's not a single thing on that computer that can't be fixed in a few hours. If they somehow actually needed a month to fix it, it would be 10x cheaper to just give you a new laptop. That month of "repair" is 3 weeks and 6 days of shipping it to someone else to fix it and getting it back, because they are clearly in over their heads. I would go down to this place and tell them that you've already been significantly inconvenienced, and this month repair shit is not acceptable, and they have 2 choice: replace it with a new one or refund.
  3. Yes you can use curl, but it is meant for real interaction between two servers. Like, if you want to send data to a server's form and get the data generated from the response. That sort of thing. If you're just scraping the page, curl is making it more complicated than it needs to be. Stick with file_get_contents. Don't quite understand what you mean...are you saying you want to grab the stuff between the bold tags? // may or may not need the 's' modifier, depending on if boundaries will be on multiple lines or not $regex = '~<span class="credits"><b>(.+?)</b>~s'; preg_match($regex,$data,$match);
  4. really? my personal and from-hearing experience with 'higher education' is that they just give you a list of all the homework/papers you need to turn in, tell you what books to buy, and then it's up to you to make sense of everything. Professor rarely around and if he is, he's reading from something or other. May as well be on TV or radio and they actually do do that a lot... One on one help? Go find a study group of people in the same boat as you, trying to figure it out. Motto seems to be that you may learn the material, but you won't learn to think for yourself when someone else is holding your hand explaining it to you. But...it's possible I've just been to and heard about crappy colleges.
  5. $timestamp[1] has the original number in it. Or you can take the date and use strtotime
  6. Try 's' modifier $find = array ('/<img/s', '/.jpg">/s');
  7. 'image/jpg' --> 'image/jpeg'
  8. <?php function bb_encode ($str) { $str = nl2br(htmlentities($str)); preg_match('~\[quote.*?date=(\d+?)\]~is',$str,$timestamp); $date = date("m:d:Y H:i:s", $timestamp[1]); $simple_search = array( '~\[quote author=(.*?)[^\]]*\]~is', '~\[/quote\]~is', ); $simple_replace = array( '<table class="bbc_quote_table"><tr><td class="bbc_quote_header"><b>Quote from </b>$1</b> on ' . $date .'</td></tr><tr><td class="bbc_quote_body">', '</td></tr></table>' ); // Do simple BBCode's $str = preg_replace ($simple_search, $simple_replace, $str); return $str; } $str = "[quote author=UrbanTwitch date=1227397761]Thank you so much!![/quote]"; echo bb_encode($str); ?>
  9. You can hop in and out of php just fine. The php parser looks at the stuff between the closing tag and next opening tag as a string it doesn't have to parse. The whole script is executed server-side then results sent to client. This is obviously a clientside issue. Why are you posting in the php forum? Moving this to the javascript forum, and I suggest you post your javascript code and possibly your css if you have any because nobody is going to be able to tell you what's wrong with out it.
  10. The code itself is fine which means the problem is a) files not spelled right (case sensitive even) b) files do not exist c) wrong path/to/image
  11. Can't help you without 'before' and 'after' examples. But it sounds like you are just wanting to convert a unix timestamp to a date string. Look at the date function. Or if you already have a date string and want to make it look different, look at strtotime + date
  12. It's possible that your connection could cause it, but it's more likely the script or server. But there's no way for me to confirm it without looking at the script or knowing nothing about the server.
  13. 70kb isn't much even by standards 10 years ago. If you are going through different wifi connects and have no issues with connection speed for other sites, then the problem is with the script or with the server.
  14. $result_links = mysql_query("SELECT * FROM links ORDER by cat"); while($row = mysql_fetch_array($result_links)) { $id=$row['id']; $cat=$row['cat']; $url=$row['url']; $display=$row['display']; echo ($prevcat != $cat)? "<h4>$cat</h4>" : ""; echo "$id $link $display"; // whatever format you want $prevcat = $cat; } ?>
  15. oops I meant remove_history() not make_history() ( and the move() )
  16. in your make_history() and move() methods, you forgot to specify the element in the sizeof() condition. Also, move is a reserved word. You might want to change that to something else.
  17. Only works on a 'global' level; that is, you cannot specify for it to ignore some things. You would have to use some regex to convert only the ones you want. Unless your target tags will always have the same content (attributes, values, same order/format), you will have to use a real regex function like preg_replace, instead of str_replace.
  18. lol yeah I don't really look like the "computer" type, either. Most people think I'm some mafia hitman.
  19. str_replace("www.","",$hostname);
  20. If you want to have dropdown#2 change based on dropdown#1, you have to have alternate lists or at least alternate list id's stored somewhere, be it flatfile, database or hardcoded inot your script. If you want to do it with only php, no sql etc.., you're going to have to select something from dropdown#1 and hit a submit button of some kind and have the whole page refresh, with the lists hardcoded as arrays in your script. PHP will not dynamically change dropdown#2 in "real-time" before form submit. It's a server-side language, and the form is on the client.
  21. fyi file_get_contents loads the entire file into one string. If you're wanting to loop through the file line by line, file will take your file and explode at the line breaks and make an array.
  22. I was being serious. But I was also shooting for an 11/10.
  23. You've got stuff all over the place in the wrong order. Even the sub-descriptions for each number don't match up properly. You obviously did no research or followed any kind of accepted standard when throwing together that list. We need to get a council together to sit down and draw up a proposal for a list that is both scalable and open-ended, to accommodate future additions, as well as retain backwards compatibility.
  24. Here is the concept: // generate example list of numbers... for ($x = 0; $x < 50; $x++) { $info[] = rand(1,10); } // end for $x sort($info); foreach($info as $num) { $count = ($prevnum != $num)? 1 : ++$count; $prevnum = $num; } // end foreach
×
×
  • 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.