Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. trq

    JSON help

    All you need do is.... echo json_encode($_POST); then. The array is already how you need it.
  2. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=313896.0
  3. trq

    JSON help

    What does.... echo '<pre>'; print_r($_POST); echo '</pre>'; look like?
  4. This would display all files with the .txt extension within the foo directory for example.... <?php foreach (glob("foo/*.txt") as $f) { echo $f . "\n"; } ?>
  5. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=313826.0
  6. Both of these designs stink. You would be best having a table for users, a table for questions, then another table that joins users with questions and answers.
  7. One thing in particular I hate. When new windows are opened at a fixed size. If people have the 'open new windows in tabs' option enabled in firefox, it makes the entire browser shrink to this fixed size. Use overlays instead of popup windows. Better looking, and they don't break browsers.
  8. It is highly unlikely that 'danny' is within the OS's file system root which is where you are trying to include it from. You will likely need to prepend the servers root path to this as well, using $_SERVER['DOCUMENT_ROOT'].
  9. Sorry, its not like I test code I post here. It was a simple mistake. $(document).ready(function() { $('.productphoto').toggle( function() {$(this).animate({width: "711px", height: "400px"},100)}, function() {$(this).animate({width: "355px", height: "200px"},100)} ); });
  10. Did you look at the link I gave you? $(document).ready(function() { $('.productphoto').toggle({ function() {$(this).animate({width: "711px", height: "400px"},100)}, function() {$(this).animate({width: "355px", height: "200px"},100)} }); });
  11. There are ways of doing it, but it requires I little bit of work. I assume this is so you can have Ajax functionality while still being able to bookmark. The way I have done it in the paste is to use a simple MVC pattern. You need a controller function which is called on every click, this then checks the url and executes a function accordingly.
  12. If your using php5 just set the recursive argument to true. See mkdir.
  13. That function is floored. You only need to escape special characters (addslashes or preferably mysql_real_escape_string) on the way into a database. htmlspecialchars should be used when using data for display, and strip_tags would only be used dependent on the situation and the data involved.
  14. find /var/www/test -name test.php -exec rsync -av --dry-run {} /var/www/test2/ \;
  15. trq

    designer

    Software is just a tool, unless you know how to use it, and you have an eye for design, it won't help much.
  16. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=313804.0
  17. trq

    designer

    Do yourself a favor and hire a designer.
  18. Just for the record, it only effects namespaced classes. Classes not under a namespace (i.e. in the "global namespace") can still use constructors named after their class. That said, class-name-based constructors went out of fashion years and years ago with __construct() being much more preferred. Finally, the namespace separator is the backslash character (\) and not the solidus (forward slash, /) as thorpe used. In other words, Foo\IO\Http. I'm on fire today.
  19. Most people who write allot of OOP in PHP use a form of psuedo namespacing anyway, but now it can be done more convenietly with 5.3. Given the directory structure of part of a simple framework. [pre] └── Foo ├── IO │ ├── Http │ │ ├── Header.php │ │ ├── Request.php │ │ └── Response.php │ ├── Request │ │ └── RequestAbstract.php │ └── Response │ └── ResponseAbstract.php ├── Loader │ └── Exception.php └── Loader.php [/pre] The Dispatch class (within the Foo/Controller/Dispatch.php file) would generally be defined by.... class Foo_IO_Http_Request extends Foo_IO_Request_RequestAbstract {} and called by .... $r = new Foo_IO_Http_Request; With 5.3 and namespaces you can now do. namespace Foo/IO/Http; use Foo/IO; class Request extends Request/RequestAbstract {} namespace Foo/IO/Http; $r = new Request;
  20. The data you have is just a string at the moment, not an object. You'll need to convert it into an object first.
  21. trq

    What is ::

    Should be a green button in the bottom left corner (or maybe top right, its bottom left for me - needless to see, its big and green).
  22. It only effects non-namespaced classes.
×
×
  • 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.