Now is: <?php echo date('l j D, Y H:i:s');?>

  1. You can use for or foreach loop:
  2. <?php
    for ($i=0; $i<10; ++$i) {
        echo "$i: ".$i*$i,"<br>"; 
    } 
    ?>
  3. You can include your own PHP library and call the functions within that library:
  4. <?php
    require_once('/fullpath/your_php_library.php');
    display_image('image123.jpg');
    ?>
  5. You can sprinkle as many PHP statements you want within your content page. Note that these PHP statements will be processed in sequential order, and it respects all scoping of variables. So if you have set a variable earlier, you can use it in your PHP statements later.
  6. <?php global $a;
    $a = 10;?>
    This is a test. variable $a = <?php echo $a;?>
    
    <?php
    function f1() {
        global $a;
        return $a*2;
    }
    $b = f1($a);
    ?>
    
    You can access variable $a from within the function with global.
    variable $b = <?php echo $b;?>
    
  7. You can add any HTML statements through PHP:
  8. <?php
    echo "<table border=4$gt;";
    echo "<tr><td>a11</td><td>a12</td></tr>";
    echo "<tr><td>a11</td><td>a12</td></tr>";
    echo "</table>";
    ?>
  9. You can easily serve different contents for registered and non-registered members:
  10. For Joomla 1.0:

    <?php
    global $my;
    if ($my->id==0) {
        // non-registered members
        print "Please register or login.";
    } else {
        // registered members
        print "Contents for registered members.";
    }
    ?>

    For Joomla 1.5:

    <?php
    $user =& JFactory::getUser();
    if ($user->id==0) {
        // non-registered members
        print "Please register or login.";
    } else {
        // registered members
        print "Contents for registered members.";
    }
    ?>