Testbed

  • Using inline php

    Testing a plug in that allows you to embed a php string within a post or page. In this case I’m embedding an Askimet badge.

    Akismet checks your comments against the Akismet web service to see if they look like spam or not. To show off your Akismet stats just put <?php akismet_counter(); > in your template.

    The snippet looks like: [exec off]akismet_counter();[/exec]

    The result is:[exec]akismet_counter();[/exec]

  • same plug in but more complex

    [exec]
    $current_dir = “$DOCUMENT_ROOT”.”training/”; //Put in second part, the directory – without a leading slash but with a trailing slash!
    $dir = opendir($current_dir); // Open the sucker

    echo (“

    List of available files:


    “);
    while ($file = readdir($dir)) // while loop
    {
    $parts = explode(“.”, $file); // pull apart the name and dissect by period
    if (is_array($parts) && count($parts) > 1) { // does the dissected array have more than one part
    $extension = end($parts); // set to we can see last file extension
    if ($extension == “ext” OR $extension == “EXT”) // is extension ext or EXT ?
    echo “ $file
    “; // If so, echo it out else do nothing cos it’s not what we want
    }
    }
    echo “


    “;
    closedir($dir); // Close the directory after we are done
    [/exec]