Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. For large XML files you'll find SimpleXML inefficient, so I swear by XMLReader mostly. That said, it shows that it depends on the job which XML parser is best. DOMDocument would be a good choice when you want to parse "invalid" XML files due to it's HTML parsing abilities (not tested).
  2. if(empty($a1) && empty($a2)) { $array1 == '' doesn't work with array's and count($array1) == '0' should be count($array1) == 0 since count() returns an integer, which wins, and the string constant '0' is converted to 0 therefor it's better to write: count($a1) == 0 You'll avoid needless conversions.
  3. LOL. Seriously though you should check your website with something else then FF4 and Chrome10 there are still people around that use FF2&3 or even older Chrome browsers. There is also Opera, and Safari. You should also make sure your website works in IE7,8&9. They still have the largest market share.
  4. Then your current approach will suffice.
  5. FWIW = For What It's Worth Design Pattern = A solution to a known problem Singleton = A design pattern, problem: Only one instance of a certain object can exist at any given time. Registry = A design pattern, problem: You need access to an object but you can't access it directly. For example you need the orders of a customer but you don't have the customer object (but through the Customer object you can retrieve the Orders). So, instead of calling/using a global variable you use a global access point to retrieve the instance. $customer = Registry::get('Customer'); Internally this will do something like: return self::getInstance()->offsetGet('Customer'); self::getInstance() returns the Singleton object. If English is too hard for you, you can also PM me in Dutch.
  6. Travian is an AJAX-driven application. So you need to think client-side instead of server-side first. The most notable is that in Travian you can walk your character down a specified path instead of just walking everywhere on the screen. Inspect the source code to find how they did it, and inspect their images. Once you figured out how they did it, you can think of how you will store it server-side.
  7. AJAX is the same as a normal request you make with your browser. The only difference is that your View in this case will have to respond to what is expected: JSON, although it could just be HTML or XML, but JSON saves bandwidth and is probably faster. In other words your Controller should not be named AJAX explicitly, it handles requests and AJAX is no different. Either reserve certain methods to return JSON (or whatever you fancy) or change to an AJAX-specific View during bootstrap.
  8. Ah but it's there where the fun part begins But this is easily solved using a FilterIterator for example. You could also adjust your logic and make sure you only pass what you also intend to show.
  9. $then = strtotime('July 7 2011 - 1 week'); // such power at the tip of your fingers $final = strtotime('July 7 2011'); $now = time(); if($now < $then) { echo 'just a little longer..'; } else if($now >= $then && $now < $final) { echo 'almost there.. almost there..'; } else if($now == $final) { echo 'celebrate good times com\'on!!'; } else { echo 'phew, what a PARTYYYY!!!'; }
  10. SELECT * FROM ourpets WHERE (species='dog' OR species='canine') AND owner='Thomas' AND sex='male'; 0 OR 1 = 1 1 OR 1 = 1 0 XOR 1 = 1 1 XOR 1 = 0 0 AND 1 = 0 1 AND 1 = 1
  11. $sql = "SELECT att.att_Lable, dat.dat_Value FROM pg_Attributes AS att LEFT JOIN pg_Data AS dat USING(att_Id)"; $res = mysql_query($sql); if($res && mysql_num_rows($res)) { while(list($label, $value) = mysql_fetch_row($res)) { $labels[$label] = $value; // $labels['head'] = 'this is a text'; } }
  12. Create a new PHP file: <?php phpinfo(); Place the file in your httpdocs and navigate to it using your browser. Cmd + F and type php.ini
  13. What is the value of $time_current, $time_old and $current_number? var_dump($time_current, $time_old, $current_number); Run this and tell us the output.
  14. NOT NULL literally means that it can't contain the special value NULL. NULL is not equal to '' (empty string) or 0 or anything else that makes the field empty. This special value is to indicate no value exists. Your confusion comes from your experience with NULL from PHP where NULL == '' returns true as where MySQL returns NULL (everything compared to NULL is NULL, unless you specifically use IS NULL
  15. All of this questions can be answered if you read the manual.
  16. You should add the path to the Doctrine directory to your include_path. If you "installed" Doctrine under /usr/lib/php then your current include_path is fine otherwise you will have to copy the full path of the directory that contains the Doctrine directory to your php.ini and add it, like this: include_path='.:/usr/lib/php:/path/to/directory'
  17. Dreamweaver will make the website look awful, it's rendering engine pretty much sucks for anything that hasn't been made in it.
  18. How do you know it is proper when you even can't read it? Or don't even know what to look for? How will you hire someone?
  19. Installing WampServer will install the needed binaries to run PHP. Configuring MySQL (if MySQL was used) database can be done through visiting http://localhost/phpmyadmin (or http://localhost/sqlbuddy if you like this one better) once WampServer is installed successfully. Launch WampServer and wait for the tray icon to turn green (the one marked with the letter W). Click the tray icon, a menu opens, click Apache, hover Alias directories, click Add an alias. Follow the directions on screen (remember the name you give to your alias). Access it like http://localhost/alias-name-here/ (trailing slash isn't optional here)
  20. Geedoo should solve the problem then
×
×
  • 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.