topdl.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 most downloaded files from your phpATM page. You can format the list with HTML code around the filenames. There is also an option to show the download count after each file name. You can include this list in another page to show there the most downloaded 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 a list with the top downloads, then you need to do this manually or you can use this script to have always the most downloaded files shown somewhere on your site.

How to install:

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

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

    1. $max_top_files: 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_download_count: shows after each file, how many times the file is downloaded if true or not if false (default true)

    5. $text_before_count: the text and/or HTML code before the download count number (default "", could be "downloaded ")

    6. $text_after_count: the text and/or HTML code before the download count number (default " times", set this to "" if you don't want text after the download count number)

    7. $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)")

    8. $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)")

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

    10. $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)")

    11. $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)

    12. $separation: defines how to separate the files if there is no linebreak (default &nbsp;|&nbsp;, this would look like "filename1 | filename2")

    13. $hide_these_dirs: hidden directories (regular expression) which most downloaded files won't be listed (default "")

  3. Upload the topdl.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/topdl.php"); ?>

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

    <php include_once("downloads/topdl.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/topdl.php"); ?>

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

    <php include_once("http://www.flavaclown.de/downloads/topdl.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:

topdl_php_-_phpATM_130_and_some_mods.zip (7kb - 11.06.2008)