latest.php for phpATM v1.30 and some mods

Released: 11.06.2008 · Base: Andrea Bugada · Made: Flava Clown · URL: flavaclown.de

What it does:

It creates a plain list with the latest files added to your phpATM page. You can format the list with HTML code around the filenames. There is also an option to show the filedate after each filename. You can include this list in another page to show there the newest files. The way it is done, it will make only sense with files which are viewable.

An example: pretend you have a page like flavaclown.de and your phpATM powered site is in a folder called downloads. Like this you will have another URL for that, just like flavaclown.de/downloads/ ... If you want to show now the visitors from flavaclown.de that you or someone else have uploaded something to the downloads site, then you need to do this manually with a news entry or you can use this script to have always the newest files shown somewhere on your site.

How to install:

  1. Unpack the latest.php to a temporary folder.

  2. Open the latest.php with your favorite PHP editor (such as Notepad++) and change the variables from the part marked as "config part of the script" (line 27 - line 48), to fit your needs.

    1. $max_last_filesf: this is the maximal number of files listed (default 5)

    2. $max_characters: the maximal number of shown characters from the filename(s) (default 20)

    3. $direct_download: a click on a filename will open the browser download dialog if set to true or will open the fileviewer if set to false (default false)

      Note: the direct download will only work if you allow downloading for anonymous user.

    4. $with_date: shows the filedate after each file if true or not if false (default true)

    5. $datetimeformatf: format of date & time in PHP time format, see php.net (default 'd.m.Y', like 15.03.2007)

    6. $text_around_before: add here the text or HTML code that you want to appear before the "file list" starts (default <ul>\n, while \n is the escaped character for a "linefeed (LF or 0x0A (10) in ASCII)")

    7. $text_around_after: add here the text or HTML code that you want to appear after the "file list" ends (default </ul>\n, while \n is the escaped character for a "linefeed (LF or 0x0A (10) in ASCII)")

    8. $text_before: add here the text or HTML code that you want to appear before every filename (default <li>)

    9. $text_after: add here the text or HTML code that you want to appear after every filename (default </li>\n, while \n is the escaped character for a "linefeed (LF or 0x0A (10) in ASCII)")

    10. $with_separation: this can be used to show the filenames in a single line with a defined separation between them, if set to true (default false)

    11. $separation: defines how to separate the files if $with_separation is set to true (default &nbsp;|&nbsp;, this would look like "filename1 | filename2")

    12. $hide_these_dirs: hidden directories (regular expression) which latest files won't be listed (default "")

  3. Upload the latest.php to your phpATM folder. If necessary change the extension.

  4. In the site where you want to show the list with the newest files, you have to include the following line:

    <?php include_once("phpatm_installfolder/latest.php"); ?>

    "phpatm_installfolder" is the folder where you have installed phpATM, for the example above the line would look like:

    <php include_once("downloads/latest.php"); ?>

    You could also use an absolut URL, for the example above the line would look like:

    <php include_once("http://www.flavaclown.de/downloads/latest.php"); ?>

    to show only the latest files from a folder of your choice, include the "latest.php" with an absolut URL, like:

    <php include_once("http://www.flavaclown.de/downloads/latest.php?show_only=foldername"); ?>

    "foldername" is the name of the folder which you want to show only. (could be also "foldername/subfoldername")

    NOTE: THIS WORKS ONLY IF THE SITE WHERE YOU WANT TO INSTALL IT GOT THE PHP EXTENSION!
    (such as index.php, welcome.php3, ...)

Feedback:

Comments? Problems? Bugs? Or just some nice words? Contact me in the phpATM Forum or send me an eMail.

Download:

latest_php_-_phpATM_130_and_some_mods.zip (7kb - 11.06.2008)