Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. What do you mean with queries? Like SQL queries?
  2. Just use a regular foreach loop. file() stores all the lines from a file in an array. <?php $users = file('users.txt'); foreach($users as $user) { echo $user . PHP_EOL; } ?>
  3. This is what I would do: Have a file with commands (could be an XML file for instance). When the bot loads it would parse the file and store all the commands you can use. Then you can update the commands file and run a command to the bot (reload_commands or something like that) and the bot would parse the commands file again.
  4. <?php $users = file('users.txt'); if(in_array($user, $users)) { echo 'User exists'; } else { echo 'User does not exist'; } ?>
  5. Here is a really simple way you can do it: <?php function load_template($tpl_name, array $arguments = array()) { foreach($arguments as $key => $value) { if($key == 'tpl_name') continue; // don't break it $$key = $value; } ob_start(); eval('?>' . file_get_contents('templates/' . $tpl_name . '.tpl.php')); $output = ob_get_contents(); ob_end_clean(); return $output; } echo load_template('test', array('title'=>'Test page', 'username'=>'Daniel')); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title><?php echo $title ?></title> </head> <body> <h1><?php echo $title ?></h1> <p>Hello <?php echo $username ?></p> </body> </html> Output: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>Test page</title> </head> <body> <h1>Test page</h1> <p>Hello Daniel</p> </body> </html> Note: The syntax highlighting broke, but it does work. It doesn't really matter what you call your template files, PHP will parse it anyways. Some people just prefer to have a .tpl extension, you can use .php, .html or whatever you'd like.
  6. Google doesn't use PHP. How do you know? Have you seen the actual GOOGLE coding? No, but some of their pages end on .py. And as neylitalo said, I quite sure they use some compiled programs behind the scene.
  7. Google doesn't use PHP.
  8. How about phpDocumentor? Example: <?php /** * Bla bla bla description of TestClass and its usage. * * @author John Doe * @package Test * @since 21 Dec, 2007 */ class TestClass { /** * Holds something * * @access private * @var boolean */ private $variable; /** * TestMethod uses bla bla and does something * * @param integer $arg1 * @param array $array * @param boolean $do_something * @see TestClass::something() */ public function test_method($arg1, array $array, $do_something = false) { } /** * Magic * * @magic * @access public */ public function __toString() { } /** * Static method which does something * * @static * @access public * @return float */ public static function static_method() { } /** * Enter description here... * * @final * @param string $var * @param integer $var2 * @return string */ final protected function something($var, $var2 = null) { } } ?>
  9. Seeing as http://www.ebuyer.com/index.php works and other extensions such as .asp, .html, .py, .pl etc. don't, I'd say yes, Ebuyer is created using PHP as well.
  10. Yahoo, Digg and Facebook do for instance. They're pretty large.
  11. When I said the files aren't linked anywhere, I meant from here as well. So I guess I was right, no links, no spider can find the files. You can't ensure that other people won't link to the directory.
  12. Nothing, that's why it is in the miscellaneous forums
  13. Why must the... err... contestants have at least 4 characters?
  14. http://php.net/set_error_handler
  15. Multiple anti-virus programs may interfere with each other. I would suggest that you remove one of them.
  16. One could only hope so... Maybe they'll start implementing things the normal way instead of the Microsoft way as well.
  17. According to the IEBlog IE8 passes the Acid2 Test: http://blogs.msdn.com/ie/archive/2007/12/19/internet-explorer-8-and-acid2-a-milestone.aspx Maybe it'll eventually get to Opera/FF level at standard compliance *wishes*.
  18. Well, if you're into web development then (X)HTML and CSS and perhaps Javascript will be important. These three are basically the three layers of web pages (respectively content, presentation and behavior). You can read about the differences between XHTML 1 and 2 here, but for now I wouldn't bother. The browsers has to support it first and at the moment Internet Explorer's standards support sucks. For PHP, just learn how to use PHP5's (it's far superior to PHP4 due it it's improved object model) features and just check what has changed in 6 when it's released. You can read about the differences between PHP4 and PHP5 here: http://www.php.net/manual/en/migration5.php As roopurt also said, don't try to learn too many things at one time. It won't work out anyways. Edit: Oh, and don't learn from old books teaching you things like accessing array indices like this: $user - it's wrong. And learn how to create table less layouts and how to separate HTML, CSS and Javascript (separation of concerns).
  19. You could use TightVNC.
  20. You might want to use /^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/ instead so you're sure there isn't anything before or after as well. Or /^\d{2}\/\d{2}\/\d{4}$/ (\d means any digit, i.e. [0-9]).
  21. You could always install GNU/Linux yourself or run it in a virtual machine.
  22. Daniel0

    Form Drop down

    Perhaps just a link would do...
  23. Maybe there is a padding on the container or maybe the cellspacing has something to do with it. Try to do it in a table less way, it's much easier to work with.
  24. Well, that's probably because you've named the input i and therefore overriding the value.
×
×
  • 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.