ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
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).
-
Come to play in my sandbox?
-
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.
-
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.
-
Then your current approach will suffice.
-
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.
-
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.
-
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.
-
Have you tried eval?
-
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.
-
And what do you want us to do about it?
-
How LARGE is large?
-
Work out if current date (today) is a week before a given date
ignace replied to denno020's topic in PHP Coding Help
$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!!!'; } -
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
-
$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'; } }
-
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
-
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.
-
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
-
creating modules controller and action for that modules
ignace replied to urzmano's topic in Frameworks
All of this questions can be answered if you read the manual. -
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'
-
Dreamweaver will make the website look awful, it's rendering engine pretty much sucks for anything that hasn't been made in it.
-
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?
-
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)
-
Geedoo should solve the problem then