Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. That function retrieves the field requested in $needed. This concept is called a variable-variable. See: http://php.net/variables.variable
  2. Perhaps like this: <?php class View { protected $data = array(); // old: ActionController:$viewData public function get($key); // old: ActionController::getVar(); public function __get($key); public function set($key, $value); // old: ActionController::setVar(); public function __set($key, $value); public function display($action); // old: ActionController::view(); } class ActionController { protected $name; protected $content; /** * @var View */ protected $view; private static $pageDir; public function __construct() { // somehow set the view: $this->view = $theView; } // etc. } ?> I didn't bother to write the method bodies.
  3. Users like me... time for a new computer.... ;-) Ah... that's what you meant when you told me you couldn't upgrade IE. I'd been wondering why...
  4. No need. I already knew the result. They're not exceptions, but errors... An uncaught exception would look something like this: Fatal error: Uncaught exception 'Exception' with message 'test' in C:\wamp\www\test.php:2 Stack trace: #0 {main} thrown in C:\wamp\www\test.php on line 2
  5. That's because nothing within the try blocks could possibly throw exceptions... The bug you linked to has been fixed.
  6. Well, you could remove all methods that deal with views and move them into another class. You could then an instance of a view in the ActionController constructor as a class property.
  7. [quote author=SemiApocalyptic link=topic=112560.msg864320#msg864320 date=1208117559] [quote author=redarrow link=topic=112560.msg859944#msg859944 date=1207656487] Seo self study (20 years experience). I have been creating web sites for other 20 years in all but have done various exams while designing my web sites. [/quote] Congratulations, you've designed websites that pre-date the inception on the web. [/quote] And he has been creating web pages for 20 years, but only known HTML for 12. Quite impressive I must say. Or just a bunch of BS perhaps...
  8. The only thing I find annoying about the updates it that they require me to reboot. The entire updating system is quite stupid IMO. It's like a three step process: 1) Install 2) Configure 3) Configure again I wonder why it has to configure the updates both when shutting down and when booting again. It's also displaying the progress of the configuring, but it doesn't seem to work properly. It just stays at 0% for a long time, then suddenly it jumps all the way to 100% and you have to wait for just as long time again.
  9. After ten minutes you're no longer able to edit your posts. That should be sufficient for fixing any errors in your post. Just reply to the topic if you have anything to add. Once you have posted 10 posts you'll be able to send PMs.
  10. I don't think Microsoft is to blame for this. SP2 was released in 2004... Time to upgrade! It's not like it's very difficult to download it from their website. Heck, if you enable automatic updates it'll do it for you. It's not their fault that people, contrary to their recommendations, don't upgrade their software.
  11. Just log the username instead of the IP address?
  12. Your "CAPTCHA" is weak. I got this: That can be pretty easily be broken using something like this: preg_match('#Enter: "([a-z ]+)" into the box below#', $pageSource, $matches); $captcha = str_replace(' ', '', $matches[1]); The register script doesn't seem to work and provides no feedback on the submitted data.
  13. Probably because they're replacing them with something else as shown above.
  14. It inverts the greediness. * is greedy, so by giving the U modifier it becomes ungreedy. An ungreedy quantifier stops looking as soon as something matches whereas a greedy quantifier keeps on looking until it cannot find any more which matches.
  15. You could do split it up and only apply the parsing on specific parts of the content. I cannot post the code here because it will break the parsing in SMF's post parser, so I uploaded it here: http://phpfreaks.com/daniel/bbcode_parsing.phps <b>bold</b> <pre>[b]not bold[/b] because it's inside code tags</pre>
  16. Try this instead. $content = preg_replace( '/\[TEST\](.*)\[\/TEST\]/U', '$1', $content);
  17. You'd have to edit the /app/config/routes.php file. For getting what you'd like I'd guess something like the code below would do. Router::connect('/tshirts', array('controller' => 'collections', 'action' => 'index')); Router::connect('/tshirts/:collection', array('controller' => 'collections', 'action' => 'view')); Router::connect('/tshirts/:collection/:name', array('controller' => 'tshirts', 'action' => 'view')); Also, check out this: http://manual.cakephp.org/chapter/configuration
  18. Try to use is_int().
  19. It doesn't load for me.
  20. I'm going to guess that the ones prefixed with U_ are URLs and L_ are language strings. You can do that rather easily with str_replace(). <?php $urls = array( 'SEARCH_UNANSWERED' => 'index.php?whatever=something', 'SOMETHING_ELSE' => 'index.php?foo=bar', ); $language_en = array( 'SEARCH_UNANSWERED' => 'Unanswered', 'SOMETHING_ELSE' => 'Something Else', ); // we suppose we have the data containing the template in a variable called $data foreach ($urls as $key => $url) { $data = str_replace("{U_{$key}}", $url, $data); } foreach ($language_en as $key => $string) { $data = str_replace("{L_{$key}}", $string, $data); } ?> I'll also move this to the PHP Help forum.
  21. I believe most frameworks allow you to set your own custom routes so you can get the URLs you want. Which framework are you using? If you haven't decided yet I'd recommend Zend Framework.
  22. Couldn't you just use that "information" for the threads? Otherwise just run another query to insert it into the threads table. It's pretty difficult to tell with that little information.
  23. You can't do that.
  24. You cannot redefine $this... Just loop through the results and set it manually.
  25. It does work... <?php $var = (object) array('bleh' => 'teh'); var_dump($var); ?> object(stdClass)#1 (1) { ["bleh"]=> string(3) "teh" }
×
×
  • 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.