Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. To be honest, I'm not sure. I've been doing a lot more Microsoft related development lately than anything else. I do use PhpStorm as my IDE on my dev machine, but it's not a free IDE. It is very nice, though.
  2. I recommend Kohana if you're just starting out. It's essentially a PHP 5 only version of CodeIgniter.
  3. Yeah, this is generally why newbies use a Singleton. It's still a bad way to go. What you should use is Dependency Injection. Since I suck at creating examples off the top of my head, look at: http://components.symfony-project.org/dependency-injection/trunk/book/01-Dependency-Injection
  4. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=355809.0
  5. I was about to flip complete shit trying to figure out how to properly post code on SO until I figured out you can just hit "ctrl+k" to automatically format it. Other sites (like reddit) unfortunately do not share that, so posting code still sucks. Huh... If you have 4+ space tabs, all you need to do is copy/paste the code over, and tag your message with the language you're posting about. Code formatting starts after the 4th space. EDIT: For SO...
  6. This: isn't intentional, is it?
  7. BBCode is a standard text formatting language that you need to figure out how to implement. The standard essentially just spells out what the tags (like , for example) should do. External libraries, like PECL, have code that you can use in your projects to do most of the heavy lifting. There are also implementations listed on the BBCode site itself: http://www.bbcode.org/implementations.php That said, look at the different standards before making the jump. I actually like Markdown better than BBCode because it's faster to specify formatting while typing (it's what Stack Overflow uses). The downside is that it's less known/more esoteric than BBCode. You'll need to balance ease of use, ease of implementation, user expectations, etc.
  8. Why not something like: class Whatever { public $outFile = "newpdf.pdf"; public $fontSize = 70; // etc. for the settings that will likely never change public function __construct($file, $overlayMsg = "N O T F O R S H O P", $options = NULL) { // $options is an optional ARRAY of, well, options that could override the existing defaults } }
  9. You need to provide more information. Namely, your db table structure.
  10. MVC is a design pattern. Tweaking it (removing models) is allowed. Remember: design patterns are purposely half-baked in order to be manipulated to fit the realities of the actual problem in front of you. Slavishly adhering to the textbook definition of patterns is doing it wrong. On Singletons, they're global, which means by their nature they break encapsulation. Usually, when people recommend using a Singleton, it's because they don't know about Dependency Injection, which is by far the better way to go. Newbies like the Singleton pattern because it's incredibly simple to understand, has a neat 'hook' (using a static method and making the constructor private), and is generally the first pattern they encounter. Unfortunately, they're almost always the wrong way to go, and learning it first teaches essentially the same bad lesson as the actual 'global' keyword. On separating presentation from business/domain logic: that's the goal regardless of whether or not you're using OOP. Your presentation layer - HTML, CSS, JavaScript - should be treated as a skin you place over the actual system. There should hardly be any PHP code in your templates. A good rule of thumb is to limit the PHP in a template to just echo, if/else, and loops, and, even then, only for when you're actually displaying values. All code that 'does stuff' (like, say, queries a DB) should exist elsewhere.
  11. If you don't want to refresh the entire page, you'll need to use AJAX.
  12. Yeah, I used the wrong term. Generally speaking, using an array, like I did, as opposed to using references is the preferred idiom in PHP. References appear so rarely in normal use, it's just convention to return multiple values via an array.
  13. Eh, using reference side effects in lieu of actual return values is kinda awkward in this context. It's easier to return an array: function nav($title, $link) { $ret = array(); $ret['title'] = "this is the title"; $ret['link'] = "this is the link"; return $ret; }
  14. You'd need to use JavaScript/jQuery to do this. Remember, PHP is completely divorced from the browser. It can generate client side code, but cannot react to it.
  15. As far as data exchange formats go, JSON is also easier to deal with than XML.
  16. You shouldn't run ANY hash more than once.
  17. Default is a PHP keyword. http://php.net/manual/en/reserved.keywords.php
  18. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=354848.0
  19. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=354819.0
  20. Turning tags into entities stops them from being treated as tags by the browser. That's important if you don't want a malicious user to post HTML or JavaScript that would be accessed every time the posted data is viewed. Try running <script type="javascript">alert("Hello World!");</script> Through the function and echo the result.
  21. Okay, so what line is throwing the error?
  22. Do you actually instantiate a PDF object?
  23. Especially when it's warm. *puke* I don't drink (or smoke, or do any kind of recreational drugs... I'm a regular Buzz Killington ), so threads like these are always interesting. They reveal a world I could never get into.
  24. @phppup - In the future, please place all of your code in either or tags. I took the liberty of doing it for you above.
×
×
  • 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.