Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. if (preg_match("/^From ([^\s]*)/", $lines[$i], $matches))
  2. People laugh at me all the time. I like to think I provide quality entertainment, but it's probably really because I'm ugly and smell funny.
  3. well glob will only return files that match the pattern, so it's not like it will return files that don't exist. if no files are found, it returns and empty array. So when array_map walks through each returned result and unlinks the file, it's either not going to unlink anything because there are no elements in the array to walk through, or else it's going to unlink a file that exists.
  4. well if you have modrewrite transforming it into say /browse/software/php you could just grab the url and explode at the / and wrap link tags around each piece. implode it back together with >
  5. double quotes tell php to parse the special chars inside the quotes. So you can use escaped chars that represent things like newline etc.. and php will parse it as a newline. Or tell php to recognize $blah as a variable to parse, rather than literally $blah. php parses stuff in single quotes literally. So with single quotes, you were telling it to replace it with a literal \n instead of a newline.
  6. wow. So I typed "php functions" into google and first thing on the list was http://www.php.net/quickref.php which looks suspiciously like a list of functions. Even has things like echo on the list. I'm still looking at that link though. It might not be what it appears to be. You know how it goes. Bait and switch, etc... maybe we can form a task force to investigate it. I know how google usually returns absolutely nothing relevant to what you're trying to find, so most people don't use it. Understandable that you wouldn't even bother trying it. I myself only resorted to it after spending an hour searching through my own collection of books and boomarked links and posts here on the forum. It was sort of a "fuck, well shit, couldn't hurt to try" last desperate attempt to come up with something thing. Frankly I'm surprised and shocked that that should pop up. I know, mind boggling, right?? I should screenshot it or something. Send it to drudgereport.com. Front page of New York Times! It might actually cause Mr. Gates to bing his pants, knowing his competition got something right for once.
  7. so after you fix that, next question would be, what makes you think it is absolutely turning up true? Does $thisPage contain what you expect? echo it out?
  8. The point of breadcrumbs is that you are navigating deeper within a page hierarchy. You have a single controller page that rewrites it to a different url yes, but the setup is still that single controller page > action so it's kind of pointless to have breadcrumbs... You can just have a static link back to the homepage, without the action being specified.
  9. in your str_replace try changing '\n' to "\n" (use double quotes instead of single quotes)
  10. additionally you can store values in a database, flatfile or cookie, and have retrieve it from there on each page. Overall point is, normal variables only have a scope for the page they are in, unless the page is being included in another page with include or require, because to php that is pretty much the same thing as it being the same script.
  11. you can assign the value to a session variable and it can be accessed from page to page. pagea.php <?php session_start(); $_SESSION['foo'] = 'bar'; ?> pageb.php <?php session_start(); echo $_SESSION['foo']; ?> A session variable will persist for the duration of the browser being open or if it times out due to inactivity (timeout default is 30m).
  12. so the text from your database already ends in \n, you're nl2bring it, only to turn around and replace the br's with \n's?
  13. well don't format $now in the first place, seeing as how you're wanting to turn around and strtotime it. Just use time() instead of date() for $now.
  14. not only define "tools" but define "web services". Virtually everything online can be classified as a web service.
  15. strtotime the two strings, subtract one from the other, divide by 60.
  16. Your most immediate problem is scope. You have a method in a class trying to call a method from an object. Well objects work just like regular variables as far as scope (mostly...). You have to pass the object to the function (or instantiate it inside the class, as ^^ mentioned) Your less immediate problem is...well I mean, I know you said this is just an illustration, but if your real code is anything like this illustration, I have to wonder about how you have the real thing setup in the first place...
  17. $string = '<font>some text</font> more text here.. <font size="">something here</font> blah blah <font >more blah</font> mmm <font style="something">blah</font> more blah <font style = "" size="3"> blah </font>'; $string = preg_replace('~<(font[^>]*size[^>]*)>(.*?)<(/font)>~','[:$1:]$2[:$3:]',$string); $string = preg_replace('~<font[^>]*>(.*?)</font>~','$1',$string); $string = preg_replace('~\[:(font[^\]]*size[^]]*):\](.*?)\[:(/font):\]~','<$1>$2<$3>',$string); so basically it first replaces all the font tags that have the size attribute in it with temporary tags. Then it removes all the rest of the font tags. Then it changes the ones with the size attribute back to real font tags. So yeah, that can probably be reduced to a single preg_replace with a negative lookahead, but I haven't quite mastered lookahead/lookbehinds yet, so maybe nrg will step in here and show me up or something.
  18. $string = '<font>some text</font> more text here.. <font size="">something here</font>'; $string = preg_replace('~<font>(.*?)</font>~','$1',$string); echo $string;
  19. You can't. I was saying MT was wrong because array_walk() won't get the job done. I was saying you were wrong in that array_walk will indeed call a predefined function, but since you can't pass anything to unlink with it, it throws the warning.
  20. you're both wrong. You can call it with array_walk, but you'll get a big fat "blah expects a parameter to be passed" error
  21. strtolower
  22. Not quite all the power of regex. But a decent amount nonetheless. Read the user notes in the manual.
  23. I don't think so, but you can first use glob to grab the file names using wildcards and then loop through the array returned from it.
  24. So I'm not entirely clear on what you're trying to accomplish. Are you saying you want to be able to just collect email addresses at the show, and send out emails to people to come fill out a signup form with more details later? You would have a form on your website asking for the detailed info like name, sex, age, etc.. and you would just include that link in your email send-out. append a unique id to the link if you wanna get all fancy and have the form lookup the user's email address and have it show up automatically on the form, or whatever. Then when user fills out the form, it would store it in your database. Is that what you're wanting to do? edit: okay so let me rephrase that: I think that you should probably do that, instead of some reverse email lookup thing. That would cost you significantly less money to make happen, and the accuracy of info retrieved would be a lot higher, not to mention you can control what data you are asking for.
  25. I noticed that the other day for the tutorials, also. But I didn't really care enough to mention it. But since someone else did, well there you have it. If I remember correctly, it was showing the right date in the actual tutorial, but not on the listing in the profile, and possibly wrong date on the general tutorial listings.
×
×
  • 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.