Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. It would be no different to how you already have it working. I don't understand where you could be stuck.
  2. You inject it into your object on instantiation. class DatabaseObject {} class SomeClassWithDBDependency { protected $db; public function __construct($db) { { $this->db = $db; } public function foo() { return $this->db->query(); } } $obj = new SomeClassWithDBDependency(new DatabaseObject); This code is still missing a few important OOP principals, but it should explain what I meen by my last comment.
  3. I have provided you with links explaining this already. Do not double post.
  4. Then your class depends on your DatabaseObject class, it doesn't need to extend it. Pass it in to your class and use it from there. Sorry, I'm still very new to OOP so I wouldn't know why. Seems still viable to me, and to the person who's tutorial I've been watching. I'm all ears though, the tutorials I've been watching are aged and I don't want to start any bad habits early. Classes are meant to encapsulate data. Pulling data in from the global scope breaks that encapsulation.
  5. apt-get update && apt-get install php5-rar Done.
  6. trq

    PHP Poll

    Please don't feed the trolls.
  7. My first question: Why does this class extend a DatabaseObject class yet you keep talking about form validation? What is this class actually meant to represent?
  8. What distro are you using? Have you tried using it's package manager instead?
  9. Nginx example: http://wiki.nginx.org/ServerBlockExample Apache Httpd example: http://httpd.apache.org/docs/current/vhosts/examples.html
  10. Yeah, they have all changed. You need to click the "beta" link at the top to see the new stuff.
  11. It's nice that they made the effort. Still, it looks dated already.
  12. This isn't exactly a difficult task, what have you actually tried?
  13. $_POST['submit'] will never be set using an onChange to submit the form. Use a hidden input instead.
  14. 2 & 3 will never happen using vim's autocompletion. And 1, well, vim gets its context from a few different locations depending on the keystroke you use to start completion. Generally, I only ever use the context of the current buffer. This meens variables will only be completed if they already exist in the current buffer. Not that I use completion often anyway.
  15. fsockopen is probably all your going to need.
  16. $filenames[0] refers to the first element in the array.
  17. Personally, I prefer Homebrew over MacPorts, but thats just my preference. There are however instructions for installing PEAR on the page you linked to.
  18. There are all sorts of ways of doing this dependant on the protocol the server speaks. If it's simply http then you can use curl though I prefer to use higher level libraries like Guzzle. But yeah, the first thing you need to figure out is what does the server expect these requests to look like.
  19. Not all user speak English natively. Your comment is not at all constructive.
  20. Create a phpinfo page so you can actually see what php.ini file to edit.
  21. <label>Gallery On <input type="radio" name="SiteGallery" value="1" <?php echo ($sitegallery == 1 ? 'checked="checked"' : ''); ?> /> </label> <label>Gallery Off <input type="radio" name="SiteGallery" value="1" <?php echo ($sitegallery == 0 ? 'checked="checked"' : ''); ?> /> </label>
  22. You logic would be telling you incorrectly. $_category is an object, you will need to call a method or a property of said object. Also, it is common place to use != rather than <> in PHP. Your end result might look something like: if ($_category->getIsActive() && $_category->name != '.') { // rest of code }
×
×
  • 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.