File repository by ItemManager
It’s best to download the latest version (2.3.2 +) of IM from extend http://get-simple.info/extend/plugin/itemmanager/936/, so you can create a new field "File upload" this allows you to upload any file formats you like.
Then, you create a new category named "repository" for example and create a field of "File upload" type for that, named "files".
Go to "Fields" menu and click "Edit field" (the gear icon), scroll down the page to "Enter accepted file types" area and specify the files types there by entering file extensions separated by pipe "|" that you want to allow to upload. For images and PDF-files you can enter following: gif|jpe?g|png|pdf
After you can create any items you like, upload your files and type any title for that.
After that design any markup you like to display the files at the frontend. You can use the code like follows in your template (PHP5.4 +):
Demo: http://im.ehret-studio.com/file-listing/
BTW: If you want to go a step further you can even use Frontainer http://get-simple.info/extend/plugin/frontainer/1015/ to set custom permissions for any created downloads.
It’s best to download the latest version (2.3.2 +) of IM from extend http://get-simple.info/extend/plugin/itemmanager/936/, so you can create a new field "File upload" this allows you to upload any file formats you like.
Then, you create a new category named "repository" for example and create a field of "File upload" type for that, named "files".
Go to "Fields" menu and click "Edit field" (the gear icon), scroll down the page to "Enter accepted file types" area and specify the files types there by entering file extensions separated by pipe "|" that you want to allow to upload. For images and PDF-files you can enter following: gif|jpe?g|png|pdf
After you can create any items you like, upload your files and type any title for that.
After that design any markup you like to display the files at the frontend. You can use the code like follows in your template (PHP5.4 +):
PHP Code:
<?php
$im = new IManager();
$itemSelector = $im->getItemClass();
/* Change "11" with your repository category-ID */
$itemSelector->init(11);
$active = $itemSelector->getItems('active=1');
foreach($active as $item)
{
if(empty($item->fields->files)) continue;
echo '<fieldset>';
echo ' <legend>'.$item->name.'</legend>';
echo ' <div>';
foreach($item->fields->files->file_name as $key => $filename) {
if(empty($filename)) continue;
$url = !empty((string)$item->fields->files->fullurl[$key]) ? $item->fields->files->fullurl[$key] : '';
$description = !empty((string)$item->fields->files->title[$key]) ? $item->fields->files->title[$key] : '';
// Render output
echo '<p><a href="'.$SITEURL.$url.'" >'.$description.'</a></p>';
}
echo ' </div>';
echo '</fieldset>';
}
?>
Demo: http://im.ehret-studio.com/file-listing/
BTW: If you want to go a step further you can even use Frontainer http://get-simple.info/extend/plugin/frontainer/1015/ to set custom permissions for any created downloads.