Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. ugh. beat me to it. you know nrg, i don't know if it's a good sign or a bad sign that our regex solutions usually always come out almost exactly the same. Well this is a simple example. Kind of hard to not come out the same. But i've noticed on more complex examples the same thing. Except you're partial to # I'm partial to ~
  2. Only site I know off the top of my head that might fit the bill is kirupa.com but I mean this is the internet...there are thousands of sites that offer one or all of the above.
  3. heredoc I see now is it better to just do leave HTML without php scripting or using this? I mean yah either way its parsed If you're just echoing something out, I don't really see the point of using heredoc over just closing your php tags and reopening them after the html/text. Only time I really ever use it is if I have a block of html/text that I need to assign to a string for whatever reason, but I want to keep the formatting nice and pretty for code readability. Not that you can't technically do that with quotes, but a) using heredoc frees you from having to escape single and double quotes, and b) most text editors I have used seem to recognize syntax highlighting for heredoc, but not sysntax highlighting for multi-line single or double quoted things. In actual practice, I'd say 99% of the time I ever actually use it is for example, email body strings.
  4. We do not condone asking or giving help for the purpose of circumventing security measures. Thread closed.
  5. heredoc
  6. Why not just escape the quotes inside the function in the first place? But anyways, in order to add slashes, you have to put the html in a variable first. You can add the addslashes(...) inside your function but if you're going to do it there, then ^^ why not just hardcode that way in the first place. If you're wanting to do it outside of the function, you can do something like this: function foo() { $string = <<<STUFF <div id="hello"> hello </div> STUFF; return $string; } echo addslashes(foo()); but if you're going to be doing that all the time anyways, then we're back to square one, in that why not just hardcode it that way to begin with
  7. Apparently so does my wife. She's the one who got to sleep in today :/
  8. you can use file_get_contents or cURL to get the content and preg_match or DOM to get the specific info.
  9. Okay so here's the thing: It's not php's fault it's sorted that way, it's your server's. The script you are using just reads the stuff from the directory as the server has it listed. But anyways, you can re-order in php lots of different ways. But in general, your script kind of sucks. It's overkill and also you are checking to see if it's a directory by virtue of not having a dot in the name somewhere. That doesn't necessarily mean it's a directory. Here is a much better way of doing it: $files = glob('*',GLOB_ONLYDIR); sort($files); //usort($files, create_function('$a,$b','return strcasecmp($a,$b);')); foreach($files as $filename) { echo "<div class=\"category\"><a href=\"game.php?id={$gameid}&page=screenshots&cat={$filename}\">{$filename}</a></div>"; } Note: the way sort() works, it sorts by ascii char comparison, so for instance, if you have this list: apple banana Orange sort() will make it like so: Orange apple banana if you want it to be case-insensitive, I included a commented out line that will do that. just remove the sort(..) and use the commented out line instead.
  10. so...are these real folders on the server or "folders" in a cms (you mentioned creating them in numerical order, whatever that's supposed to mean)? How are you retrieving the names of them? How are you displaying them? Don't expect anything just "goes without saying," because it doesn't.
  11. QFT. See that's actually where your problem begins. PHP (or anything else for that matter) is not very good at "making sense" of Plain Text. If you have the ability to save it with tags or delimiters then your problem can very easily be solved.
  12. where are the category names coming from? what are you doing to sort it? How are we supposed to even begin to help you when you don't explain these things or post code?
  13. you can do if($_GET) {...} or if(count($_GET) > 0) {...}
  14. no not really... a class is like a blueprint/design/description for an object. Like for instance, if you want to define a dog. Things, or 'properties' of a dog: - name - size - weight - color - breed Things, or 'methods' a typical dog might do/have: - eat - poop - sleep So these things about a dog would be described in a class, and for example, your little dog muffy would be an instance of that dog class.
  15. or combine a sortby and regex in your query. or you can go through and rewrite all of the titles to put it on the end like so: Simpsons, The It's acceptable to leave it like that, displaying it, or if you want to nonetheless display it as "The Simpsons" you can have a condition in your display loop to look for it and reorder it.
  16. Those sites depend on 2 things: 1) the domain name being so good/kickass/common that random people tend to find it on their own 2) companies being gullible enough to think hey yah this is stupid, but can we afford NOT to do it? Works especially well the better #1 is and if said company has competitors listed
  17. it means there is something wrong with a link or query string being sent to the server. A malformed or invalid url or something.
  18. so what are going to do with that function if you want to know what % 13 out of 45 is?
  19. umm..so how is $percents = 7 / (10/100); any easier than $percents = (7 / 10) * 100;
  20. He's a very busy guy. He can't be bothered with details like reading past the first post. Also, if you live by the philosophy that you are right and everybody else is wrong (which a lot of people seem to), it's really a waste of time to read past the first post. So he's just being efficient here. You should applaud him.
  21. I actually do have a real pic of me posted somewhere around here. I don't remember where, but I doubt it's in any of the public forums.
  22. haha well my goal isn't to be the next superstar with a record deal. I was thinking more along the lines of being able to play campfire type songs etc.. with the kids. Maybe get into playing some folk songs.
  23. wow people still go for that sort of thing?
  24. It's typical for me to say what everybody is thinking? Holy crap, I'm psychic??
×
×
  • 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.