| Attachment Mod User Guide
Please note: The following documentation makes reference to the mod's author Acyd Burn. The author is not responsible for supporting this mod within the PNphpBB module. All support questions should be directed to PNphpBB.com and the support team there. This is the February, 2003 revision of the Attachment Mod User Guide. This Guide is intended for all phpBB users using the Attachment Mod. It answers common questions and gives a quick overview of features and the internal workings of this Mod. Introduction Feature List Installation Basic things to keep in mind How to read the Installation Instructions What do you need in order to run certain features How to install with templates other than subSilver Admin Rights or 'Why do you need a User Account' ? The Attachment Administration Panels Control Panel Management Quota Limits Shadow Attachments Synchronize Attachments The Extensions Administration Panels Extension Control Extension Groups Control Extension Groups Forum Permissions Forbidden Extensions Special Categories General Administrative Settings and Features (HowTo's) How to set up Permissions for Attaching and Downloading The Quota System How to set up Default quotas How to set up User and Group quotas How Quota Limit Changes will affect User and Group Quotas How to get Thumbnails working How to use the Attachment Mod Posting and Editing Attachments - Posts and Private Messages Additional Viewable Areas User Profiles User Attachment Control Panel How to change the 'look & feel' Some basics about the Template Engine The viewtopic_attach_body.tpl file Common Problems attaching Files Filesize too big / Post Mode not specified / Blank Page Could not attach File, but Post has been stored / Filesize is 0 all over the time General Error: Could not Attach File I am able to attach files in Private Messages, but with normal Posts i cannot Attach files No Attachments are displayed Copyright and Disclaimer ## 1. Introduction This User Guide is intended to give an overview of what the Attachment Modification is capable of and teach you how to setup and utilize its features. It should answer the most common questions and give you the chance to use the full power of the Attachment Mod. While reading this, you will stumble over some terms and explanations you might not know; keep these in mind, they may be explained in further paragraphs. If you find errors or would like to contribute something please contact me. If you have Support Questions, please go to the Opentools Board and ask your Question there. There are two other Boards that I visit frequently:phpBBHacks.com and phpBB.com. If you do not find an answer at phpBB.com, you may ask your Question at phpBBHacks.com or Opentools.de. Please do not post the same question at phpBBHacks.com and Opentools.de; I check both sites regularly therefore you only need to post once. phpBB.com has only one thread available for supporting the Attachment Mod. This can make it hard to find the correct answer, do your best to search the whole thread before asking for support. If you want to suggest a new Feature, please go to the Feature Request Tracker. Bug reports should go into the Bug Tracker at Opentools. Additionally you are invited to the #attachmod channel at freenode.net if you want to discuss something. The Attachment Modification also has a dedicated CVS Archive. You may browse it at SourceForge.net. Happy reading, Acyd Burn. ## 2. Feature List The following is a list of Attach Mod features Full Permissions System You are able to set Download Permissions, Upload Permissions and Extension Groups per Forum Permissions. Able to add comments to Attachments Automatic Deletion of Attachments if Posts are deleted (manual Delete, pruning, within the Moderator Control Panel or the User Attachment Control Panel). Editing of existing Attachments. Able to Delete/Add/Change Comment and Update Attachments while editing Posts. If the local path for Attachments is changed in admin, all previous posted attachments will be displayed correctly. Category support (Special behaviour instead of just presenting a link to the attached file) Special behaviour on Images: Thumbnail Support Image Link Presentation depending on Dimensions Inline Images Stream Files directly within Posts. Supported Types: aif, aifc, aiff, asf, asx, au, avi, ivf, m3u, mid, midi, mlv, mp2, mp3, mp2v, mpa, mpe, mpeg, mpg, mpv2, rmi, snd, wav, wax, wm, wma, wmx, wmv, wvx Play Flash Files within Posts (Also supports compressed Flash MX Files). An image for displaying in front of Attachments and Threads containing Attachments (definable). Able to define an Image for Forum View and for every Extension Group. Maximum Upload Size definable. Maximum Upload Size per Extension Group definable. Multiple attachments in one post. Maximum number of attachments per post definable. Multiple attachments in one PM. Maximum number of attachments per PM definable. Attachment Quotas: Overall Attachment Quota User Attachment Quotas Group Attachment Quotas Quotas are definable for PM Boxes and Upload Download counter. Download Method selectable for every Extension Group. This is very useful for Data types needing a 'real' link, for example real media files. Three Upload Methods: Upload FTP Upload FTP Remote Upload Able to display Attachments in Preview Window. Able to display Attachments in Review Window. User Attachment Control Panel. Attachment Limit Box within Private Message Box. Attachment Upload Stats in Users Profile. Special Admin Modules: Manage Forbidden Extensions Manage allowed Extensions (Delete, Add, Assign new group) Manage Extension Groups Manage Special Categories Synchronize Attachments Delete Shadow Attachments (those Attachments not deleted with posts, for whatever reason) A complete Attachment Control Panel (with an integrated search feature) Much more! To sum it up, a fully customizable Attachment Feature for your Board. Language Packs: For up-to-date Language Packs and more information please visit http://www.opentools.de/attach_mod/ or the Language Pack Forum at http://www.opentools.de/board (if someone is willing to translate the Attachment Mod to other Languages, please contact me at Opentools.de) Database-support: mysql, mysql4, mssql, mssql-odbc, postgresql ## 3. Installation ### 3.1 Basic things to keep in mind The following are a few things you keep in mind when installing the Attachment Mod. Make sure that PHP File uploading is allowed by your Provider. If it is not you will be unable to attach files at all. Before you begin to install the Mod, backup your Message Board (the Files and the Database)! If something goes wrong, you are able to switch to the backed up version of your Board. Be sure to upload .html, .php, .tpl, .sql files in ASCII Mode with your FTP Client. Don't forget to chmod your upload directory to 777. If you would like to utilize the cached configuration method, do not forget to create a 'cache' directory (ie. /phpBB2/cache) and to chmod this directory to 777. Don't forget to run the Database Installer or the Updater (if you are updating the mod). When configuring Attachment Mod for your Message Board, use the built in "Test Setup" feature to double check that your configuration is correct. ### 3.2 How to read the Installation Instructions If you've previously modified, or if you are familiar with the usual layout of phpBB Modification instructions you can skip this section. Instructions for Uploading Files: Since we are installing the Attachment Mod into phpBB2, we are always at the phpBB2 Root Folder (where your config.php file is). If an Upload Instruction says:
/attach_mod/scripts/mod_table_inst.php -> mod_table_inst.php
You have to upload the left part (found within the Archive) to the right part. Since we are at the phpBB2 Root Folder, the file "mod_table_inst.php" has to be uploaded to it. Another Example:
/attach_mod/root/admin/admin_attachments.php -> admin/admin_attachments.php
You have to upload the admin_attachments.php file found in attach_mod/root/admin to your phpBB2 admin directory. These are the basic Instructions for editing existing phpBB2 Files, taken from the Mod Template Tutorial at http://www.phpbb.com:
# #-----[ OPEN ]------------------------------------------ #
Open a specific file.
# #-----[ FIND ]------------------------------------------ #
Find a piece of code within the opened file.
# #-----[ REPLACE WITH ]------------------------------------------ #
Replace a piece of code (whatever we "FIND") with this code.
# #-----[ AFTER, ADD ]------------------------------------------ #
After the last code line shown in "FIND", add this piece of code.
# #-----[ BEFORE, ADD ]------------------------------------------ #
Before the first code line shown in "FIND", add this piece of code.
# #-----[ IN-LINE FIND ]------------------------------------------ #
Find a piece of code within a code line.
# #-----[ IN-LINE AFTER, ADD ]------------------------------------------ #
After a piece of code in a code line, add this piece of code.
# #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ #
Before a piece of code in a code line, add this piece of code. Here are examples of each 'Action':
# #-----[ OPEN ]------------------------------------------ # templates/subSilver/posting_body.tpl
In the above example, we are opening the file: posting_body.tpl which is located in the 'subSilver' directory, under templates.
# #-----[ FIND ]------------------------------------------ # {L_NEW_POSTS}
In this instance, we are going to look within the file we previously opened, and FIND the text: {L_NEW_POSTS}.
# #-----[ REPLACE WITH ]------------------------------------------ # {L_YOUR_VARIABLE}
In this instance, we are REPLACING {L_NEW_POSTS} WITH {L_YOUR_VARIABLE}.
# #-----[ AFTER, ADD ]------------------------------------------ # <img src="templates/subSilver/images/some_new_image.gif" alt="{L_YOUR_VARIABLE}"/>
In this instance, AFTER {L_NEW_POSTS} we are ADDING a new image.
# #-----[ BEFORE, ADD ]------------------------------------------ # <img src="templates/subSilver/images/some_new_image.gif" alt="{L_YOUR_VARIABLE}"/>
In this instance, BEFORE {L_NEW_POSTS} we are ADDING a new image.
# #-----[ IN-LINE FIND ]------------------------------------------ # user_from = '" . str_replace("\'", "''", $location) . "',
For finding code in a code line.
# #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # user_from_flag = '$user_flag',
This example adds user_from_flag = '$user_flag', directly after the code line you have used in the IN-LINE FIND action.
# #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # user_from_flag = '$user_flag',
This example adds user_from_flag = '$user_flag', directly before the code line you have used in the FIND action. After editing all Files you have to upload them for the changes to take effect on your website. ### 3.3 What do you need in order to run certain features You need the following to use the FTP Upload Feature (Remote and Normal): FTP Extensions built into the PHP Installation. You need the following to create Thumbnails: ImageMagick installed on the Server (you are not able to install this if do not have root administrative access to your server). OR GD Extensions built into the PHP Installation. It is highly recommended to use ImageMagick if it is installed on the server. If the exec() function is not allowed to be called within your PHP Installation, you are unable to use ImageMagick to create thumbnails. ### 3.4 How to install with templates other than subSilver You have to upload all new tpl-files within the Attachment Mod Archive to your template directory and make all changes made to the subSilver tpl-files to your template files too. The best thing to do this is to read the Installation Instructions and substitute the name subSilver with your template name. ## 4. Admin Rights or 'Why do you need a User Account' ? With the Attachment Mod the Administrator has special rights when it comes to attaching Files. The following Restrictions are not taken into account for Admins: Able to exceed the allowed Filesize. Able to attach all allowed and activated Extensions. Able to exceed the maximum Number of Attachments per Post/PM. Able to attach and download files in all forums. Default Quota for Admins is set to the complete Attachment Filesize Quota. If you are testing the Attachment Mod and want to be sure that all Restrictions you have set are actually working, please create a normal User Account for testing. ## 5. The Attachment Administration Panels ### 5.1 Control Panel The Control Panel is intended for the Administrator to manage the attached Files, to see some Statistics and search for Attachments. There are four possible Modes that you are able to view at the control panel: Statistics, Search Attachments, Attachments by an particular User and All Attachments. Statistics
View:
Statistic | Value
--- | ---
Number of Attachments: | 21
Total Filesize: | 1.89 MB
Attachment Quota: | 50 MB
Number of Posts with Attachments: | 13
Total Number of Attachments in Private Messages: | 2
Number of Topics with Attachments: | 11
Independent Users Posted Attachments: | 3
As you can see, the Statistics gives you a short overview of all posted Attachments. Search Attachments
View:
Search Attachments
Filename: Use * as a wildcard for partial matches |
File Comment: Use * as a wildcard for partial matches |
Search for Author: Use * as a wildcard for partial matches |
Attachment size smaller than (bytes): |
Attachment size greater than (bytes): |
Download count is smaller than: |
Download count is greater than: |
More than this many days old: |
Search Options
Forum: |
Category: |
Select sort method: |
Order: |
Very self explanatory, isn't it? View Attachments by Username The first thing to do is to view the Username based Statistics
View: Select sort method: Order
# | Username | Attachments | Size (KB)
--- | --- | --- | ---
1 | testuser | 11 | 553.68
2 | Acyd Burn | 10 | 1376.83
3 | Anonymous | 1 | 2.29
Now I want to see which Attachments the User 'testuser' has attached, therefore I click on the Username.
View: Select sort method: Order
# | Filename | File Comment | Extension | Size (KB) | Downloads | Post Time | Posted in Topic | Delete
--- | --- | --- | --- | --- | --- | --- | --- | ---
1 | acyd_ava.gif |  | gif | 3.1 |  | 17 Nov 2002 08:55 pm | fsgjiosd |
2 | acyd_ava.gif |  | gif | 3.1 |  | 17 Nov 2002 09:01 pm | zrezerw |
3 | linux10.jpg |  | jpg | 48.04 |  | 17 Nov 2002 08:56 pm | fsgjiosd |
4 | linux13.jpg |  | jpg | 108.27 |  | 17 Nov 2002 08:56 pm | fsgjiosd |
5 | linux13.jpg |  | jpg | 108.27 |  | 17 Nov 2002 09:01 pm | zrezerw |
6 | linux_chick1.jpg |  | jpg | 53.29 |  | 17 Nov 2002 09:01 pm | zrezerw |
7 | linux_chick1.jpg |  | jpg | 53.29 |  | 17 Nov 2002 08:59 pm | sdgsdag |
8 | acyd.jpg |  | jpg | 43.52 |  | 17 Nov 2002 08:59 pm | sdgsdag |
9 | takeittux.jpg |  | jpg | 21.46 |  | 17 Nov 2002 08:59 pm | sdgsdag |
10 | linux13.jpg |  | jpg | 108.27 |  | 17 Nov 2002 09:02 pm | Private Message |
11 | acyd_ava.gif |  | gif | 3.1 |  | 17 Dec 2002 08:56 pm | Private Message |
Mark all :: Unmark all
Here you are able to change the Download Counts and Comments manually. You are also able to view each Attachment, delete them or go directly to the Topic where it is posted at. View All Attachments This Panel looks like the Username based Attachments Panel and the one you see after you have searched for an Attachment. The only difference is that you see all Attachments, not only the ones you have searched for or the ones one User has attached. ### 5.2 Management This Section describes the Administration Panel->Attachments->Management Screen. We will go through every configuration option and explain what it means and how it will affect the board.
Upload Directory Enter the relative path from your phpBB2 installation to the Attachments upload directory. For example, enter 'files' if your phpBB2 Installation is located at http://www.yourdomain.com/phpBB2 and the Attachment Upload Directory is located at http://www.yourdomain.com/phpBB2/files. |
Ok, this Option is for defining your Upload Directory, where your uploaded Files will be placed into. If you use (or want to use) FTP Upload this setting is not needed, the Attachment Mod will use the FTP Settings instead. Please only let the Attachment Mod place files into this Upload Directory, do not upload files for your own into this directory. If you do so, they will be overwritten and the Shadow Attachments Screen will be confused. Examples: Your Website URL for uploaded files: http://www.yoursite.com/phpBB2/files Upload Directory: files Your Website URL for uploaded files: http://www.yoursite.com/files Your Website URL to your phpBB2 Board: http://www.yoursite.com/phpBB2 Upload Directory: ./../files You see, the Upload Directory is always relative to your phpBB2 Directory. Of course you are able to set absolute paths too, but you have to know the 'complete' directory (and not URL) then.
Attachment Posting Icon This Image is displayed next to Attachment Links in individual Postings. Leave this field empty if you don't want an icon to be displayed. This Setting will be overwritten by the Settings in Extension Groups Management. |
The Attachment Posting Icon is a little Image displayed beside links to Attachments within Posts and Private Messages. This setting defines the default Image, if you define Posting Icons for Extension Groups, this default Setting will not be used, only for those Extension Groups with an undefined Icon. The Path is relative to your phpBB2 Directory.
Attachment Topic Icon This Image is displayed before topics with Attachments. Leave this field empty if you don't want an icon to be displayed. |
The Attachment Topic Icon is for defining a little Image displayed in front of topics containing Attachments. It is not only for displaying within viewforum, it will be displayed within the Moderation Control Panel and the Private Message Box too.
Attachment Display Order Here you can choose whether to display the Attachments in Posts/PMs in Descending Filetime Order (Newest Attachment First) or Ascending Filetime Order (Oldest Attachment First). |
Descending
Ascending
This Setting is for defining the Ordering of Attachments within Posts and Private Messages. This affects only those Posts and Private Messages with more than one Attachment. For ordering, the Time the Attachment got uploaded is used and not the time the Post was made.
Filesize Maximum filesize for Attachments. A value of 0 means 'unlimited'. This Setting is restricted by your Server Configuration. For example, if your php Configuration only allows a maximum of 2 MB uploads, this cannot be overwritten by the Mod. |
This Setting defines the Maximum Filesize for one Attachment. This Setting is restricted by your PHP Configuration. If your provider does not allow file uploads or set them to 0 byte, or restricted it to 2 MB for example, the Mod is unable to overwrite this value. If your provider has set the maximum upload size to 2 MB and you define a filesize of 5 MB, you are only able to upload a maximum filesize of 2 MB.
Attachment Quota Maximum Disk Space ALL Attachments can hold on your Webspace. A value of 0 means 'unlimited'. |
This is your highest Attachment Quota Setting, even the Administrator is not allowed to exceed this Limit. This Setting is to prevent too many uploads; most providers are setting limitations to usable disk space.
Maximum Filesize in Private Messages Folder Maximum Disk Space Attachments can use up in each User's Private Message box. A value of 0 means 'unlimited'. |
This setting is a default Quota Limit for every users' Private Message Box. Users without a quota setting are limited to this Filesize within their Private Message Box. This setting determines the total space taken by all Attachments within the users' Private Message Box, not the size of each file.
Default Quota Limit Here you are able to select the Default Quota Limit automatically assigned to newly registered Users and Users without an defined Quota Limit. The Option 'No Quota Limit' is for not using any Attachment Quotas, instead using the default Settings you have defined within this Management Panel. |
| Upload Quota
| PM Quota
This Setting defines your Default Quota Limits. The Upload Quota is for limiting the User on Attachments posted in Messages, and the PM Quota on Attachments within users Private Message Box. Since within this example a PM Quota of 'No Quota Limit' is set, the 'Maximum Filesize in Private Messages Folder' Setting will be used. If the Upload Quota is set to 'No Quota Limit' the 'Attachment Quota' Setting will be used. Please keep in mind, even if you set a Upload Quota Limit higher than the Attachment Quota, this Limit will fall back to the defined Attachment Quota, because this is your highest definable Value.
Maximum Number of Attachments The maximum number of attachments allowed in one post. |
This Setting is for defining the maximum Number of Attachments allowed to be uploaded to one Post.
Maximum number of Attachments in one Private Message Define the maximum number of attachments the user is allowed to include in a private message. |
This Setting is for defining the maximum Number of Attachments allowed to be uploaded to one Private Message.
Disable Attachment Mod This option is mainly for testing new templates or themes, it disables all Attachment Functions except the Admin Panel. | Yes No
This Option is for disabling the Attachment Mod.
Allow Attachments in Private Messages Allow/Disallow attaching files to Private Messages. | Yes No
This Option is for allowing or disallowing Users to be able to attach Files to Private Messages.
Do you want to display Attachments in the Topic Review Window ? If you choose yes, all attached Files will be displayed in Topic Review when you post a reply. | Yes No
This Option let you choose whether you want to show previously posted Attachments within the Topic Review Window while Replying to Threads or not. Please keep in mind allowing this Option will add additional Load to your Posting Page.
Show new Attachment Posting Control Panel Choose whether to display the Attachment Posting Control Panel (yes) or the old method with two Boxes for Attaching Files and editing your posted Attachments (no) within your Posting Screen. The look of it is very hard to explain, therefore it's best to try it out. | Yes No
This Option will enable or disable the Attachment Posting Control Panel. If set to yes, your Attachment Box will look like this:
Attachment Posting Control Panel
If you click on Add an Attachment, you will see the box for adding Attachments. If you click on Posted Attachments, you will see a list of already attached Files and you are able to edit them. If you want to Replace (Upload new Version) an Attachment, you have to click both links. Add the Attachment as you normally would do, thereafter don't click on Add Attachment, rather click on Upload New Version at the Attachment Entry you intend to update.
Options |
If set to no, your Attachment Box will look like this:
Add an Attachment
If you do not want to add an Attachment to your Post, please leave the Fields blank Allowed Extensions and Sizes
Filename |
File Comment |
Posted Attachments
Filename | acydamp.zip
File Comment | A very long description
Options |
You are not able to use the FTP Upload Methods, because FTP Extensions are not compiled into your PHP Installation.
If you see this Note, you are unable to use the FTP Upload Methods.
Enable FTP Upload Enable/Disable the FTP Upload option. If you set it to yes, you have to define the Attachment FTP Settings and the Upload Directory is no longer used. | Yes No
This Option is for enabling FTP and FTP Remote Upload.
FTP Upload Server Here you can enter the IP-Address or FTP-Hostname of the Server used for your uploaded files. If you leave this field empty, the Server on which your phpBB2 Board is installed will be used. Please note that it is not allowed to add ftp:// or something else to the address, just plain ftp.foo.com or, which is a lot faster, the plain IP Address. |
This is for defining your FTP Upload Server. If you want to define a remote Server for uploading your Files through FTP, enter the IP Address of this Server. If you want to use the same Server your phpBB2 Board is installed, leave this field empty. The default Port 21 is used for FTP Uploads.
FTP Path to your upload directory The Directory where your Attachments will be stored. This Directory doesn't have to be chmodded. Please don't enter your IP or FTP-Address here, this input field is only for the FTP Path. For example: /home/web/uploads |
This Setting is for defining the FTP Upload Path, this seems to be the trickiest setting for users, since this path does not depend on your phpBB2 Path. This Setting depends on your FTP Entry Point when connecting to your FTP Server. If you set a relative Path here, please keep this in mind. Now some examples for better understanding: If you connect to your FTP Server, the lowest path where you are is: public_html Your phpBB2 Board is at: public_html/phpBB2 Your Upload Directory is at: public_html/uploads Your complete home path at this Server is: /home/web/users/v92387 (most users do not know this path, they have to look up their Provider Information to find this one out) A relative Path to your Upload Directory would be: public_html/uploads An absolute Path to your Upload Directory would be: /home/web/users/v92387/public_html/uploads
Download Link to FTP Path Enter the URL to your FTP Path, where your Attachments are stored. If you are using a Remote FTP Server, please enter the complete url, for example http://www.mystorage.com/phpBB2/upload. If you are using your Local Host to store your Files, you are able to enter the url path relative to your phpBB2 Directory, for example 'upload'. A trailing slash will be removed. Leave this field empty, if the FTP Path is not accessible from the Internet. With this field empty you are unable to use the physical download method. |
This Setting is relevant for downloading Attachments. If you are not using a Remote FTP Server, you are able to enter the path relative to your phpBB2 Directory: phpBB2 URL: http://www.mysite.com/phpBB2 Upload URL: http://www.mysite.com/phpBB2/uploads Download Link to FTP Path: uploads If you are using a Remote FTP Server, you have to enter a complete URL to your Upload Directory: phpBB2 URL: http://www.mysite.com/phpBB2 Upload URL: http://www.storageplace.com/uploads Download Link to FTP Path: http://www.storageplace.com/uploads If you are unable to access your FTP Upload Directory directly from the web, you are able to leave this field blank. But then you are unable to use the physical download method, but this one is used rarely. More about the download methods will be explained later.
Enable FTP Passive Mode The PASV command requests that the remote server open a port for the data connection and return the address of that port. The remote server listens on that port and the client connects to it. | Yes No
This is for using the FTP Passive Mode to Upload and Download Attachments, some FTP Server are configured the way to only allow Passive Mode connections. If FTP Uploading does not work for you, try to enable/disable this Mode.
Your FTP Username |
Here you have to enter the Username with which you are connecting to your FTP Server.
Your FTP Password |
Here you have to enter the Password with which you are connecting to your FTP Server.
With the Submit button you are submitting your changes. With the Reset button you are re-setting your changes. With the Test Settings Button you are able to test your entered settings. For example, if you have chosen FTP Upload, the Attachment Mod is testing if all settings are correct and if the Mod is able to connect to the server and to upload a file. With Test Settings you receive more accurate Errors on what you have missed or what is not working as in the posting Screen. ### 5.3 Quota Limits Within this Panel you are able to define the Constants for your Quota Limits, you are able to add new Quota Limits, change existing ones and delete them. The following is the default Quota Limit View
Manage Attachment Quota Limits
Description | Filesize | Add
--- | --- | ---
Description | Filesize | Delete
View |
View |
View |
At the Top you are able to add a new Quota Limit. You can assign the listed Quota Limits to Users and Groups later. To assign a Quota Limit to a User, you have to go to Users->Management, select the User and you will see the Options at the bottom. To assign a Quota Limit to a Group, go to Groups->Management, select the Group to edit it, and you will see the Configuration Settings. If you want to see, which Users and Groups are assigned to a specific Quota Limit, click on 'View' at the left of the Quota Description. Now let's have a look at the 'View' of the 'Medium' Limit # Medium
Assigned Users - Upload Quota
Assigned Groups - Upload Quota
Assigned Users - PM Quota
Assigned Groups - PM Quota
This View is only for informing you about the Groups and Users assigned to the Quota Limit. To change this for Users and Groups, you have to go the the Groups Management Screen or the Users Management Screen. More about Quota Limits and how they work is explained in four additional Sections: The Quota System How to set up Default quotas How to set up User and Group quotas How Quota Limit Changes will affect User and Group Quotas ### 5.4 Shadow Attachments Within the Shadow Attachments Screen you can delete Attachments from Posts or Private Messages. You are also able to delete Files no longer assigned to any Post or Private Message. It is recommended to handle this Screen very carefully, view the Attachments before you delete them (if a link to the Attachment is provided). After you have deleted Attachments, Synchronize them (see next Section). ### 5.5 Synchronize Attachments With this Link you are able to Synchronize your Attachments. The Attachment Mod goes to all topics and posts verifying if the Attachment Data is correct, since every topic and every Post with Attachments is marked, this mark has to be deleted if no Attachment exists. Normally this is dnne automatically, therefore it is advised to run this Sync only if you have problems viewing Attachments. Next, Synchronization will detect if the Thumbnail Data on Attachments is correct, if no Thumbnail exists on Attachment (marked as having a Thumbnail) this Attachment will be reset and the Thumbnail Data deleted. Here is a typical Output of this Synchronize (I have manually deleted Thumbnails to show you the Reset Information): Sync Topics ....................... Sync Thumbnails ....... Attachment Syncronization Finished. Thumbnail resetted for Attachment: acyd.jpg Thumbnail resetted for Attachment: takeittux.JPG Thumbnail resetted for Attachment: linux_chick1.jpg Thumbnail resetted for Attachment: linux13_177.jpg Thumbnail resetted for Attachment: linux_chick1_145.jpg Thumbnail resetted for Attachment: linux13_131.jpg ## 6. The Extensions Administration Panels ### 6.1 Extension Control Within this Panel, you are able to add and delete Extensions. Every Extension is assigned to an Extension Group, whether this Group is enabled or not. There is a special Extension Group for pending Extensions, it is called 'Not Assigned'. If a Extension Group gets deleted, the Extensions assigned to this Group are automatically unassigned, meaning they are pending status. These Extensions are of course not allowed to be attached to your Board. You are able to enter an Explanation for your Extensions, the Explanation is only viewable to you within this Panel and is intended for you to better identify it. The following is an example of this Panel, click a few DropDown-Boxes to see which Extension Groups I have set up on my test board.
Manage Extensions
Explanation | Extension | Extension Group | Add
--- | --- | --- | ---
Explanation | Extension | Extension Group | Delete
| gif |  |
| png |  |
| jpeg |  |
| jpg |  |
| gtar |  |
| gz |  |
| tar |  |
| zip |  |
| rar |  |
| ace |  |
| txt |  |
| c |  |
| h |  |
| cpp |  |
| hpp |  |
| diz |  |
| xls |  |
| doc |  |
| dot |  |
| pdf |  |
| ai |  |
| ps |  |
| ppt |  |
| rm |  |
| wma |  |
| mp3 |  |
| avi |  |
| wmv |  |
| swf |  |
| tif |  |
| tga |  |
If you want to add an Extension, you have to click the little checkbox before you click the Add Extension Button, this is to prevent Users accidentally submitting changes they do not want. To delete Extensions, just click the Checkbox beside an existing Extension. To change the Extension Group of an Extension, just select it with the DropDown Box. After you have made all changes you can click Submit to enter them into the Database. ### 6.2 Extension Groups Control Ok, this Panel is for defining almost everything handling with Extensions. Since every Extension has to be in one Extension Group, the Extension Groups are the main Configuration Point you can set up. Let us have a look at a Standard Panel for Extension Groups
Manage Extension Groups
Extension Group | Special Category | Allowed | Download Mode | Upload Icon | Maximum Filesize | Allowed Forums | Add
--- | --- | --- | --- | --- | --- | --- | ---
Extension Group | Special Category | Allowed | Download Mode | Upload Icon | Maximum Filesize | Allowed Forums | Delete
+ |
|  |  |  |  |  | Group Permissions |
+ |
|  |  |  |  |  | Group Permissions |
+ |
|  |  |  |  |  | Group Permissions |
+ |
|  |  |  |  |  | Group Permissions |
+ |
|  |  |  |  |  | Group Permissions |
+ |
|  |  |  |  |  | Group Permissions |
+ |
|  |  |  |  |  | Group Permissions |
+ |
|  |  |  |  |  | Group Permissions |
As you can see, there are a bunch of Options/Settings you are able to change. We are going through all of them step by step. First, I will explain the Options you are able to choose from. Special Category You are able to assign a Special Category to Extension Groups, the same Special Category is allowed to be assigned to more than one Extension Group. At the moment there are four Special Categories: none, Images, Stream Files and Flash Files. You are able to define the Settings taking effect for the Special Category Images within the Special Categories Admin Panel (see Section 6.4 (Special Categories) for details). Extensions (posted Files with the Extension) within Extension Groups assigned to the Special Category 'Stream Files' are automatically played within the Post/PM. The supported Types for streaming files highly depends on the User's Windows Media Player Plugin. These Extensions have been reported to be working: aif, aifc, aiff, asf, asx, au, avi, ivf, m3u, mid, midi, mlv, mp2, mp3, mp2v, mpa, mpe, mpeg, mpg, mpv2, rmi, snd, wav, wax, wm, wma, wmx, wmv and wxv Extensions (posted Files with the Extension) within Extension Groups assigned to the Special Category 'Flash Files' are automatically played within the Post/PM. Of course this Special Category is intended for Flash Files. ;) The Setting 'none' is not a Special Category. If 'none' is selected the Attachment Mod displays a simple Download Link to the File, this is the normal way the Attachment Mod handles Files. Allowed or not Allowed There is a little Checkbox for letting you allow an Extension Group. Only if Extension Groups are allowed, the Users (and you) are able to attach Files with the Extension defined within the allowed Extension Group. Download Mode There are two possible Download Methods you are able to use: physical and logical. The physical method: This will point the attachment link to the original File. If you (or a user) click on an Attachment which Extension Group is set to physical download method, the browser will point directly to this file. Of course the download.php file is called to check Permissions and other things, but the delivery method consist of a simple Location Header (or Refresh if the Server does not Support this Header). The downside of this method is that Users sometimes receive cryptic Filenames (with random Numbers at the end) and your Upload Directory has to be accessible from the Internet. Therefore, this method should only be used for Extensions that need the File in complete. I only know of one: Real Media Files. Additionally, try this Download Method if you think your downloaded Files got garbled. The logical method: The Logical Download Method is the standard Method to use. It's for pointing the User to the correct Attachment and presenting them the correct Name for the Attachment, even if it's saved differently at your webspace. Even if the Upload Directory is not accessible from the Internet, the File gets downloaded correctly. Upload Icon This Setting is the same as within the Management Screen (Setting Name: 'Attachment Posting Icon'). You are able to define those Attachment Posting Icons individually for every Extension Group. If an Upload Icon is empty, the one from the Management Panel will be used. Maximum Filesize You are able to define the Maximum allowed filesize for Attachments within Extension Groups, this is definable for every Extension Group. If you change the Maximum allowed filesize within the Management Panel and you haven't changed the Filesizes for Extension Groups, the Extension Groups are getting updated to reflect this new Filesize. Add an Extension Group
Manage Extension Groups
Extension Group | Special Category | Allowed | Download Mode | Upload Icon | Maximum Filesize | Allowed Forums | Add
--- | --- | --- | --- | --- | --- | --- | ---
To add an Extension Group, you have to enter a Name for the Extension Group and click the Add Checkbox. After you have clicked on Submit the Extension Group will be added. You are also able to define the additional Settings too, of course. Newly added Extension Groups are empty by default, you have to assign Extensions to Extension Groups with the Extension Control Panel. Viewing Extensions You can have a look at the Extensions assigned to an particular Extension Group by clicking at the plus sign
Extension Group | Special Category | Allowed | Download Mode | Upload Icon | Maximum Filesize | Allowed Forums | Delete
--- | --- | --- | --- | --- | --- | --- | ---
- |
|  |  |  |  |  | Group Permissions |
gif |  |  |  |  |  |  |
png |  |  |  |  |  |  |
jpeg |  |  |  |  |  |  |
jpg |  |  |  |  |  |  |
### 6.2.1 Extension Groups Forum Permissions If you click the Group Permissions Link, you are able to choose the Forums where the User is able to Post Attachments with Extensions defined within the Extension Group. For example, if I click on the Permissions Link for the Extension Group 'My Images'
Allowed Forums
Add Forums
The following is the Introduction Text for Group Permissions: Here you are able to restrict the selected Extension Group to Forums of your choice (defined in the Allowed Forums Box). The Default is to allow Extension Groups to all Forums the User is able to Attach Files into (the normal way the Attachment Mod has since the beginning). Just add those Forums you want the Extension Group (the Extensions within this Group) to be allowed there, the default ALL FORUMS will disappear when you add Forums to the List. You are able to re-add ALL FORUMS at any given Time. If you add a Forum to your Board and the Permission is set to ALL FORUMS nothing will change. But if you have changed and restricted the access to certain Forums, you have to check back here to add your newly created Forum. It is easy to do this automatically, but this will force you to edit a bunch of Files, therefore I have chosen to keep it the way it is now. Keep in mind that all of your Forums will be listed here. ### 6.3 Forbidden Extensions Within this Panel you are able to define Extensions forbidden to be attached. There are three default Extensions you are not able to delete, because they will open a huge security leak into your Board. Also, the Extensions defined here are unable to be added to the allowed Extensions, and Administrators are not able to attach them too. Within this Panel only the high security risk Extensions should be added, because the Mod is configured to only allow enabled Extensions to be attached there is no need to define all Extensions you want to not be attached here. ### 6.4 Special Categories Within this Panel you are able to define Parameters and Settings for Extension Groups within Special Categories. At the moment only the Special Category Images are configurable here. The Header is showing you to which Extension Group/Groups this changes will have effects on
Settings for Special Category: Images Assigned Group: My Images
The Special Category is called 'Images' and the assigned Extension Group is 'My Images'. Now to the settings you are able to make to the Special Category Images:
Display Images Inlined Choose whether to display images directly within the post (yes) or to display images as a link ? | Yes No
If this is set to yes, the posted Extensions within the Extension Group 'My Images' will be displayed as an image:
acyd_ava.gif
Description: |
This is my Avatar Image
Filesize: | 3.1 KB
Viewed: | 10 Time(s)
-> The Image will be displayed here <-
The Inline display can be restricted by the Image Link Dimensions (will be explained here too).
Create Thumbnail Always create a Thumbnail. This feature overrides nearly all Settings within this Special Category, except of the Maximum Image Dimensions. With this Feature a Thumbnail will be displayed within the post, the User can click it to open the real Image. Please Note that this feature requires Imagick to be installed, if it's not installed or if Safe-Mode is enabled the GD-Extension of PHP will be used. If the Image-Type is not supported by PHP, this Feature will be not used. | Yes No
This Setting is for enabling the Creation of Thumbnails. The only Setting affecting this Option is the Image Link Dimensions Setting. This Setting could be hidden from you if the Attachment Mod detect that you are unable to create Thumbnails. Please refer to Section 7.6 on how to get Thumbnails working.
Minimum Thumbnail Filesize If a Image is smaller than this defined Filesize, no Thumbnail will be created, because it's small enough. | Bytes
Somewhat self-explaining, but I want to add a little note here. If your server-config is broken or the filesize() function is not allowed, the Attachment Mod will identify all Attachments as having a filesize of 0 Bytes, meaning that a Thumbnail will never be created. This Setting could be hidden from you if the Attachment Mod detect that you are unable to create Thumbnails.
Imagick Program (Complete Path) Enter the Path to the convert program of imagick, normally /usr/bin/convert (on windows: c:/imagemagick/convert.exe). |
Make sure the path to imagemagick does not contain Spaces. (for example 'program files' <- there is a space within the directory name, this will not work) You are able to search for this Program with the Search Imagick Button.
Maximum Image Dimensions Here you can define the maximum allowed Image Dimension to be attached (Width x Height in pixels). If it is set to 0x0, this feature is disabled. With some Images this Feature will not work due to limitations in PHP. | x
This Setting is for defining the Maximum allowed Image Dimensions to be posted. This is to prevent you from screwing up your Board with too high Resolution Images or because you simply do not want to let Images greater than 1024x768 to be posted (for example).
Image Link Dimensions If this defined Dimension of an Image is reached, the Image will be displayed as a Link, rather than displaying it inlined, if Inline View is enabled (Width x Height in pixels). If it is set to 0x0, this feature is disabled. With some Images this Feature will not work due to limitations in PHP. | x
This is for defining the border from Inline View to displaying an Link. If the Dimension you set here is exceeded, the Image is displayed as an Link. This Setting overrides the Inline View (of course) and the Thumbnail Creation. If you want to create Thumbnails of all Images, the best is to set this Dimension to 0x0.
With the Search Imagick Button you are able to Search for the ImageMagick program. With the Test Settings you are able to test the Thumbnail Settings, it is highly recommended to do this, because this procedure creates a directory under your Upload Directory with the name 'thumbs' for placing the Thumbnails into it. If this Directory does not exist, the Attachment Mod is unable to create Thumbnails. ## 7. General Administrative Settings and Features (HowTo's) ### 7.1 How to set up Permissions for Attaching and Downloading Yes, you are able to set Permissions on downloading and attaching files. The Permissions are the same as the ones you know for Reading, Voting, Create Polls... If you set Permissions for Downloading and Attaching, please be sure to use the Advanced Mode. A little Example: You want to create a Usergroup allowed to attach files, you want downloading to be restricted to Registered Users only. These Permissions are for your Forum called 'Downloads' (only an example). The Usergroup: Create a new Usergroup, name it for Example: attach users Open up the Forum Permissions Control Panel, select your Forum (here: Downloads) and go to the Advanced Mode. Set the Permission to attach Files to PRIVATE (to be able to assign it to the Usergroup) and the Permission to Download Files to REG. Now go to the Usergroups Permissions Panel and change the Permission for the Group 'attach users' to YES at the 'Downloads'-Forum. As you can see, the two Permissions (Attaching and Downloading) acting like the other Permissions you are able to set/configure. ### 7.2 The Quota System The Quota System is defined as limiting Users/Groups to a defined maximum Storage Limit. This Limit is not set on a per file basis, it is a general setting, counting the Filesize of all attached Files by the User/Group. Quota Limits are definable for Uploaded Files within Posts and for uploaded Files within Private Messages. Attachments included into Private Messages in your SENT Box are not counted. There is one Setting (within the Management Screen) for defining a maximum Attachment Quota, this defined Filesize is the largest Storage Limit you are able to set, no Quota Limit is able to exceed this defined Limit, even the Administrator is not allowed to exceed this Limit. The Group Quota is defined as a Quota Limit to each User of the Group, not the Group in whole. If there are multiple quotas set for one user, only one quota will be used by AttachMod: Group Quotas have the highest Priority, if more than one Group exists for the User, the Group with the largest (in Size) Quota will be given the highest Priority. User Quotas have the lowest priority. Example: User A has a quota of 30 megabytes assigned to him/her. User A is in Group Alpha and Group Beta. Group Alpha has a quota of 20 megabytes and Group Beta has no quota. User A will be given a quota of 20 megabytes; not 30 megabytes because Group Alpha has the largest quota of the two groups and takes priority over user quotas. Remember, no quota may be larger than the "Attachment Quota" setup in the "Management Screen". (See Section 5.2) ### 7.3 How to set up Default quotas Default Quotas will be assigned to newly registered Users and Users with no Quota Setting. You are able to define Default Quotas within the Attachments Management Screen. A value of 'No Quota Limit' disables the Assignment of Quotas to newly registered Users, they will have no Quota Limit. If no Quota Limit is assigned, the System Parameters are used, this means every User is able to attach Files until the complete Attachment Quota is reached. ### 7.4 How to set up User and Group quotas User Quotas will be assigned to Users. You are able to directly assign a Quota Limit to a User by using the Users Management Administration Panel. After you have chosen the User you want to edit, have a look at the 'Special admin-only fields'. You should see two new dropdown boxes: Upload Quota and PM Quota. You are able to define the Quota Limit for any specific User now. Group Quotas will be assigned to Groups. You are able to assign a Quota Limit to an existing Group. If you want to create a new Group, you will not see the Quota Settings, you have to create the Group, then you have to edit the Group in order to set the Quota Limits in the same way as the User Quota Limits. ### 7.5 How Quota Limit Changes will affect User and Group Quotas If you want to change the Filesize Limit for your Medium Storage Limit from 1 MB to 2 MB, you probably won't want to go through each user and group and set each quote individually. This method was implemented for that very reason. With the Attachment Mod you are able to define Quota Constants, setting a descriptive word for your Limit. For example: Medium -> 1 MB Now you assign this constant (Medium) to two Groups and ten Users. After a week you notice that the Quota is too low and you want to change it to 2 MB. Now you only have to change the constant from 1 MB to 2 MB, the change will be directly assigned to your two Groups and ten Users. If a Quota Constant is deleted, all Users/Groups with this defined Setting are automatically switched back to the Default/No Quota Setting. You are able to see which Users/Groups are assigned to which Quota Setting too. Please have a look at Section 5.3 (Quota Limits) in order to see how your are able to set/change/delete Quota Settings and how to view the current Quota Assignments. ### 7.6 How to get Thumbnails working The ability to create Thumbnails are only given to the Special Category 'Images'. Therefore you have to assign this Category to an Extension Group first. After you have assigned the Special Category 'Images' to one (or more) Extension Groups within the Administration Panel -> Extension Groups Management Screen you have to go to Administration Panel -> Special Categories. Enable the Option to Create Thumbnails. Additionally, set the Image Link Dimensions to 0x0 if you don't want to present Links to your Image if they are greater than the defined size you have entered there. The last Step is to Test the Thumbnail Settings. The Test Process will create the necessary Directory too. You should also search for the ImageMagick program if you are unable to recall the correct path to the program. Please make sure the path to imagemagick does not contain Spaces. (for example 'program files' <- there is a space within the directory name, this will not work) If you do not see the Options for Thumbnails the Attachment Mod detected that you are not able to create Thumbnails, therefore it was disabled. ## 8. How to use the Attachment Mod ### 8.1 Posting and Editing Attachments - Posts and Private Messages In general you are able to post, edit and delete Attachments within Posts and Private Messages. I will explain the procedure for Posts, since for Private Messages it is the same. To open your board and post a message while reading this section will help you to understand what is explained here. To see something while reading, the explanation usually becomes more helpful. While writing a new post, you will see the Attachment Posting Control Panel, either you will see two buttons to open the Add Attachments Box and the Posted Attachments Box or you will see both boxes at the beginning, this depends on how the Administrator (you) has set the view within the Attachment Management Screen. Within the Add Attachment Box you will see a little link to the Attachment Rules, there you are able to see a little overview of what you are able to attach and which filesize restrictions are set. Within the Add Attachment Box you are able to enter a comment for your Attachment and you are able to add a file itself by clicking the Browse Button. After you have chosen a file you want to attach (comment field is allowed to be left blank) you are able to click the Add Attachment Button to add the file. If you directly click submit the file will still be added with the Post. Within the Posted Attachment Box you are able to edit your file comments or delete Attachments. After you have changed an existing comment, you have to click the Update Comment button. You are able to delete Attachments by clicking the Delete Attachment Button on the Attachment Entry you want to delete. The Administrator is able to delete Thumbnails from Posts. After deleting a Thumbnail the normal Image is displayed. You are able to replace a file too (practical for uploading new versions of files). Select the file you want to upload (without clicking the Add Attachment button) and click the Upload New Version Button. ### 8.2 Additional Viewable Areas ### 8.2.1 User Profiles The user itself is able to view his Upload Status and Quota Setting within his Profile. The Administrator is able to view it too. Here is an example of this Status Field
0% | 50% | 100%
[Uploaded: 550.58 KB / Quota: 2 MB / 27% of total] User Attachment Control Panel
As you can see, the user is able to see his current uploaded filesize and the complete Filesize he is able to Upload. The Link to the User Attachment Control Panel will open the User Attachment Control Panel. ### 8.2.2 User Attachment Control Panel Within this Panel, the user is able to see all of his uploaded Files and is able to delete them. It will look like this: User Attachment Control Panel :: testuser
| Select sort method: Order
# | Filename | File Comment | Extension | Size (KB) | Downloads | Post Time | Posted in Topic | Delete
--- | --- | --- | --- | --- | --- | --- | --- | ---
1 | linux13.jpg |  | jpg | 108.27 | 1 | Sun Nov 17, 2002 8:56 pm | fsgjiosd |
2 | linux13.jpg |  | jpg | 108.27 | 1 | Sun Nov 17, 2002 9:01 pm | zrezerw |
3 | linux13.jpg |  | jpg | 108.27 | 1 | Sun Nov 17, 2002 9:02 pm | Private Message |
4 | linux_chick1.jpg |  | jpg | 53.29 | 1 | Sun Nov 17, 2002 8:59 pm | sdgsdag |
5 | linux_chick1.jpg |  | jpg | 53.29 | 1 | Sun Nov 17, 2002 9:01 pm | zrezerw |
6 | linux10.jpg |  | jpg | 48.04 | 2 | Sun Nov 17, 2002 8:56 pm | fsgjiosd |
7 | acyd.jpg |  | jpg | 43.52 | 0 | Sun Nov 17, 2002 8:59 pm | sdgsdag |
8 | takeittux.jpg |  | jpg | 21.46 | 0 | Sun Nov 17, 2002 8:59 pm | sdgsdag |
9 | acyd_ava.gif |  | gif | 3.1 | 14 | Sun Nov 17, 2002 8:55 pm | fsgjiosd |
10 | acyd_ava.gif |  | gif | 3.1 | 10 | Sun Nov 17, 2002 9:01 pm | zrezerw |
Mark all :: Unmark all
As you can see, the user is able to do nearly the same as the Administrator is able to do within the Attachment Control Panel. The Administrator is able to view the Control Panel for Anonymous/Guest Users too. You are able to do so by calling the User Attachment Control Panel directly with the Anonymous User ID
http://www.yourdomain.com/phpBB2/uacp.php?u=-1
## 9. How to change the 'look&feel' ### 9.1 Some basics about the Template Engine Template Variables To explain Template Variables, lets have a look at a very basic .tpl file, with only some Variables included
<html> <head> <title>{TITLE}</title> </head> <body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}"> {L_MY_HOMEPAGE} </body> </html>
As you can see, there are some really strange things... there is text enclosed between {}, what does this mean ? The Template system of phpBB2 replaces everything within these braces with pre-defined Values. If a variable is not defined within the PHP-Files, there is nothing shown for this 'empty' Variable. An example
{L_MY_HOMEPAGE}
As you can see, there is a L_ before the name MY_HOMEPAGE, this is just a convention the phpBB Group set (this is only a rough guide, not all Developers or Mod Authors follow them), saying that everything beginning with L_ should be replaced by a Language specific Word/Sentence. Ok, say, within the English language files there is a line saying "My Homepage" and in the German language file it's saying "Meine Startseite". If you have set English as your board language, {L_MY_HOMEPAGE} get replaced by "My Homepage"
My Homepage
Another example
{TITLE}
There is no L_ before it, therefore it must be a configurable thing or a value from the database (this can be topic-names, post-texts etc.). {TITLE} is the title of your page (within this Example). Maybe:
PhpBB.com
You may wonder what the T_ stands for? I think these are variables defined in the Styles Administration, any variable defining a custom color or css-style or something else handling with HTML-specific things. Another precedence not listed here is S_, this stands for complete input or select-fields. And last but not least, the U_ precedence. This is mainly used for Links, for example
<a href="{U_DOWNLOAD_LINK}">{L_DOWNLOAD}</a>
To sum this up: The Text, enclosed between { and } will be replaced with pre-defined Values, these Values are up to the Developer. You sometimes have to look at the code if you want to find out what Value it is holding actually, if you are unable to call or guess it directly from the name. Our first example after it was parsed by the Template Engine:
<html> <head> <title>phpBB.de</title> </head> <body bgcolor="#FFFFFF" text="#000000" link="#003366"> Meine Startseite </body> </html>
Template Switches In phpBB2 you or the developers do not want to display things if a particular action or situation is not given. A little example
<!-- BEGIN user_logged_in --> {L_WELCOME_USER} <!-- END user_logged_in -->
As you can see, switches have two definable areas, one with a BEGIN, and one with an END. All code between it is only parsed and showed to the User if the Switch is "True". True means, the action or situation is taken, for this example, the user is logged in. At the most places, the Block Variable (see next section) is preceded with switch_ to identify it as a switch, since switches are empty Block Variables. Switches have to be in ONE Line, no other code can be around one switch-line (spaces don't count). WRONG (the switch does not work)
<body bgcolor="#FFFFFF"> <!-- BEGIN user_logged_in --> {L_WELCOME_USER} <!-- END user_logged_in -->
CORRECT (the switch will work):
<!-- BEGIN user_logged_in --> {L_WELCOME_USER} <!-- END user_logged_in -->
Ok, I think you've got it, now the parsed one: If the user is logged in
Hello, welcome to our new board.
If the user is not logged in then nothing shown. Block Variables/Switches Ok, this is the really cool stuff in templates. If you have ever asked why the templates are so small, and the board layout is so big, ever asked why there is only one table for all posts, then the answer is: block variables. Block Variables are having the same Layout as Switches, but they contain Data (Switches are nothing other than Block Variables without Data). I will give an example: Say we have two posts
My first post message is here. This message is also here. It is the second one. :D
Ok, these two lines are our posts at our thread we want to display. Now, how do we display them?
<!-- BEGIN postrow --> {postrow.MESSAGE} <!-- END postrow -->
We have a switch and a Variable here, but the Variable looks strange... The switch name is preceded to the Variable Name. {MESSAGE} is our post message, therefore {postrow.MESSAGE} is every message in postrow. The row gets evaluated every time the template can find a corresponding variable. You can think of an array or a buffer of variables, postrow is like an array. Another example, but now we have even nested Block Variables
Message 1: Attachment 1 Attachment 2 Attachment 3 Message 2: Attachment 1 Attachment 2
We want to do this: Display every Message (we don't know how many these are) and within every Message the posted Attachments (we don't know how many there are for every Message). What we are using now are two blocks, one for every message and a second block (within the first one) for the Attachments
<table> <!-- BEGIN postrow --> <tr> <td> {postrow.MESSAGE} <!-- BEGIN attachrow --> <hr> {postrow.attachrow.ATTACHMENT} <br /> <!-- END attachrow --> </td> </tr> <!-- END postrow --> </table>
Look at the above example, try to follow the steps the Template will do and try to understand a little bit how it would be processed. ### 9.2 The viewtopic_attach_body.tpl file The viewtopic_attach_body.tpl is proposed for the Attachment View in viewtopic and in Private Messages, there are Block Variables for any situation (link, inline Images, Flash Files, Streams and Thumbnails). If this File gets evaluated we are already in a Block Switch (postrow). Because we can have more than one Attachment in one post, at the beginning of this file we have another Block Switch, attach. At the beginning the switch has to be opened with <!-- BEGIN attach --> and at the end of the file it has to be closed with <!-- END attach -->. Therefore all Variables have to be preceded with postrow.attach. (to catch the Post Row and the Attachments). To explain the different parts, here is the content of the viewtopic_attach_body.tpl file
<style type="text/css"> <!-- td.attachrow { font: normal 11px Verdana, Arial, Helvetica, sans-serif; color : {T_BODY_TEXT}; border-color : {T_BODY_TEXT}; } table.attachtable { font: normal 12px Verdana, Arial, Helvetica, sans-serif; color : {T_BODY_TEXT}; border-color : {T_BODY_TEXT}; border-collapse : collapse; } --> </style> <!-- BEGIN attach --> <br /><br /> <!-- BEGIN denyrow --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.denyrow.L_DENIED}</span></b></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END denyrow --> <!-- BEGIN cat_stream --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_stream.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_stream.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.FILESIZE} {postrow.attach.cat_stream.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /> <object id="wmp" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <param name="FileName" value="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}"> <param name="ShowControls" value="1"> <param name="ShowDisplay" value="0"> <param name="ShowStatusBar" value="1"> <param name="AutoSize" value="1"> <param name="AutoStart" value="0"> <param name="Visible" value="1"> <param name="AnimationStart" value="0"> <param name="Loop" value="0"> <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" src="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}" name=MediaPlayer2 showcontrols=1 showdisplay=0 showstatusbar=1 autosize=1 autostart=0 visible=1 animationatstart=0 loop=0></embed> </object> <br /><br /> </td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_stream --> <!-- BEGIN cat_swf --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_swf.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_swf.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.FILESIZE} {postrow.attach.cat_swf.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="{postrow.attach.cat_swf.WIDTH}" height="{postrow.attach.cat_swf.HEIGHT}"> <param name=movie value="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}"> <param name=loop value=1> <param name=quality value=high> <param name=scale value=noborder> <param name=wmode value=transparent> <param name=bgcolor value=#000000> <embed src="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}" loop=1 quality=high scale=noborder wmode=transparent bgcolor=#000000 width="{postrow.attach.cat_swf.WIDTH}" height="{postrow.attach.cat_swf.HEIGHT}" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> </object><br /><br /> </td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_swf --> <!-- BEGIN cat_images --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_images.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_images.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.FILESIZE} {postrow.attach.cat_images.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /><img src="{postrow.attach.cat_images.IMG_SRC}" alt="{postrow.attach.cat_images.DOWNLOAD_NAME}" border="0" /><br /><br /></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_images --> <!-- BEGIN cat_thumb_images --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_thumb_images.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.FILESIZE} {postrow.attach.cat_thumb_images.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /><a href="{postrow.attach.cat_thumb_images.IMG_SRC}" target="_blank"><img src="{postrow.attach.cat_thumb_images.IMG_THUMB_SRC}" alt="{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}" border="0" /></a><br /><br /></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_thumb_images --> <!-- BEGIN attachrow --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.attachrow.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.attachrow.COMMENT}</span></td> </tr> </table> </td> <td rowspan="4" align="center" width="10%" class="attachrow">{postrow.attach.attachrow.S_UPLOAD_IMAGE}<br /><a href="{postrow.attach.attachrow.U_DOWNLOAD_LINK}" {postrow.attach.attachrow.TARGET_BLANK} class="genmed"><b>{L_DOWNLOAD}</b></a></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILENAME}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.DOWNLOAD_NAME}</span></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.FILESIZE} {postrow.attach.attachrow.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.L_DOWNLOAD_COUNT}</span></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END attachrow --> <!-- END attach -->
There are some basic Language Variables usable within every Block:
Template Variable | Value
{L_DESCRIPTION} | 'Description'
{L_DOWNLOAD} | 'Download'
{L_FILESIZE} | 'Filesize'
{L_FILENAME} | 'Filename'
Now to the Blocks. DENYROW
<!-- BEGIN denyrow --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.denyrow.L_DENIED}</span></b></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END denyrow -->
Ok, the first Block Variable is denyrow. denyrow. It is used if an Extension for the posted file was disabled after Posting the File. The Variable {postrow.attachmod.denyrow.L_DENIED} is a language variable and gets evaluated to:
The Extension 'jpg' was deactivated by an board admin, therefore this Attachment is not displayed.
'jpg' is the Extension of course. The complete Layout of the Denied Block looks like this
The Extension 'jpg' was deactivated by an board admin, therefore this Attachment is not displayed.
CAT_STREAM
<!-- BEGIN cat_stream --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_stream.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_stream.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class=tarot;attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.FILESIZE} {postrow.attach.cat_stream.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /> <object id="wmp" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <param name="FileName" value="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}"> <param name="ShowControls" value="1"> <param name="ShowDisplay" value="0"> <param name="ShowStatusBar" value="1"> <param name="AutoSize" value="1"> <param name="AutoStart" value="0"> <param name="Visible" value="1"> <param name="AnimationStart" value="0"> <param name="Loop" value="0"> <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" src="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}" name=MediaPlayer2 showcontrols=1 showdisplay=0 showstatusbar=1 autosize=1 autostart=0 visible=1 animationatstart=0 loop=0></embed> </object> <br /><br /> </td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_stream -->
The cat_stream Block is for displaying Streaming Files. It is a special Category you have to assign to the appropriate Extension Group. The following are the defined Variables and their corresponding meaning.
Variable Name | Description
--- | ---
{postrow.attach.cat_stream.DOWNLOAD_NAME} | The displayed Download Name, this is the Real Filename.
{postrow.attach.cat_stream.COMMENT} | Attachment Comment, the comment the User have entered for this Streaming File
{postrow.attach.cat_stream.FILESIZE} | The Filesize in human readable Format, without the Size Identifier (Bytes, KB or MB).
{postrow.attach.cat_stream.SIZE_VAR} | The Size Identifier. Possible Values: Bytes, KB and MB
{postrow.attach.cat_stream.L_DOWNLOADED_VIEWED} | A normal language Variable, for Streams this is 'Viewed'.
{postrow.attach.cat_stream.L_DOWNLOAD_COUNT} | The Download Count, how many Times this Stream has been viewed.
{postrow.attach.cat_stream.U_DOWNLOAD_LINK} | The physical Filename. For Streams the download.php is not called, because the Windows Media Player Plugin is used and it does not work with the stream the download.php file produces.
{postrow.attach.cat_stream.S_UPLOAD_IMAGE} | This is the predefined Upload Image for Attachments within Posts, default: icon_clip.gif If such an upload image is assigned to the extension group the file to be shown belongs to is defined, this image will be displayed instead of the default one. This Variable is not used within this Block.
The complete Layout of the Stream Block looks like this:
A little movie.wmv
Description: |
This is a Test Movie
Filesize: | 501.14 KB
Viewed: | 4 Time(s)
-> The Stream will be displayed here <-
CAT_SWF
<!-- BEGIN cat_swf --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_swf.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_swf.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.FILESIZE} {postrow.attach.cat_swf.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="{postrow.attach.cat_swf.WIDTH}" height="{postrow.attach.cat_swf.HEIGHT}"> <param name=movie value="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}"> <param name=loop value=1> <param name=quality value=high> <param name=scale value=noborder> <param name=wmode value=transparent> <param name=bgcolor value=#000000> <embed src="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}" loop=1 quality=high scale=noborder wmode=transparent bgcolor=#000000 width="{postrow.attach.cat_swf.WIDTH}" height="{postrow.attach.cat_swf.HEIGHT}" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> </object><br /><br /> </td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_swf -->
The cat_swf Block is for playing Flash Files directly within the Post/PM. It is a special Category, which you have to assign to the appropriate Extension Group. The following are the defined Variables and their corresponding meaning.
Variable Name | Description
--- | ---
{postrow.attach.cat_swf.DOWNLOAD_NAME} | The displayed Download Name, this is the Real Filename.
{postrow.attach.cat_swf.COMMENT} | Attachment Comment, the comment the User have entered for this Flash File
{postrow.attach.cat_swf.FILESIZE} | The Filesize in human readable Format, without the Size Identifier (Bytes, KB or MB).
{postrow.attach.cat_swf.SIZE_VAR} | The Size Identifier. Possible Values: Bytes, KB and MB
{postrow.attach.cat_swf.L_DOWNLOADED_VIEWED} | A normal Language Variable, for Flash Files this is 'Viewed'.
{postrow.attach.cat_swf.L_DOWNLOAD_COUNT} | The Download Count, how many Times this Flash File has been viewed.
{postrow.attach.cat_swf.U_DOWNLOAD_LINK} | The physical Filename. For Flash Files the download.php is not called, because the Macromedia Flash Player Plugin is used and it does not work with the stream the download.php file produces.
{postrow.attach.cat_swf.WIDTH} | The Width of the Flash File, in pixel.
{postrow.attach.cat_swf.HEIGHT} | The Height of the Flash File, in pixel.
{postrow.attach.cat_swf.S_UPLOAD_IMAGE} | This is the predefined Upload Image for Attachments within Posts, default: icon_clip.gif If such an upload image is assigned to the extension group the file to be shown belongs to is defined, this image will be displayed instead of the default one. This Variable is not used within this Block.
The complete Layout of the Flash File Block looks like this:
attachtest_f6.swf
Description: |
Flash MX File
Filesize: | 1.03 KB
Viewed: | 7 Time(s)
-> The Flash File will be played here <-
CAT_IMAGES
<!-- BEGIN cat_images --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_images.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_images.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.FILESIZE} {postrow.attach.cat_images.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /><img src="{postrow.attach.cat_images.IMG_SRC}" alt="{postrow.attach.cat_images.DOWNLOAD_NAME}" border="0" /><br /><br /></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_images -->
The Image Row Block is for displaying Images inlined (inlined means the image is displayed, not a link to the image), the User is able to view the Image directly. It is a special Category, which you have to assign to the appropriate Extension Group. The following are the defined Variables and their corresponding meaning.
Variable Name | Description
--- | ---
{postrow.attach.cat_images.DOWNLOAD_NAME} | The displayed Download Name, this is the Real Filename.
{postrow.attach.cat_images.COMMENT} | Attachment Comment, the comment the User have entered for this Image
{postrow.attach.cat_images.FILESIZE} | The Filesize in human readable Format, without the Size Identifier (Bytes, KB or MB).
{postrow.attach.cat_images.SIZE_VAR} | The Size Identifier. Possible Values: Bytes, KB and MB
{postrow.attach.cat_images.L_DOWNLOADED_VIEWED} | A normal Language Variable, for Images this is 'Viewed'.
{postrow.attach.cat_images.L_DOWNLOAD_COUNT} | The Download Count, how many Times this Image has been viewed.
{postrow.attach.cat_images.IMG_SRC} | The Link/Source to the Image. This Link will call the download.php file if the download path is not reachable directly (download.php?id=12 will be called for example), otherwise it will directly point to the image.
{postrow.attach.cat_images.S_UPLOAD_IMAGE} | This is the predefined Upload Image for Attachments within Posts, default: icon_clip.gif If such an upload image is assigned to the extension group the file to be shown belongs to is defined, this image will be displayed instead of the default one. This Variable is not used within this Block.
The complete Layout of the Image File Block looks like this:
acyd_ava.gif
Description: |
This is my Avatar Image
Filesize: | 3.1 KB
Viewed: | 10 Time(s)
-> The Image will be displayed here <-
CAT_THUMB_IMAGES
<!-- BEGIN cat_thumb_images --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.cat_thumb_images.COMMENT}</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.FILESIZE} {postrow.attach.cat_thumb_images.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.L_DOWNLOAD_COUNT}</span></td> </tr> <tr> <td colspan="2" align="center"><br /><a href="{postrow.attach.cat_thumb_images.IMG_SRC}" target="_blank"><img src="{postrow.attach.cat_thumb_images.IMG_THUMB_SRC}" alt="{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}" border="0" /></a><br /><br /></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END cat_thumb_images -->
The Thumbnail Image Block is for displaying Thumbnails of attached Images, the User is able to click the Thumbnail in order to view the Image in full size. The following are the defined Variables and their corresponding meaning.
Variable Name | Description
--- | ---
{postrow.attach.cat_thumb_images.DOWNLOAD_NAME} | The displayed Download Name, this is the Real Filename.
{postrow.attach.cat_thumb_images.COMMENT} | Attachment Comment, the comment the User have entered for this Image
{postrow.attach.cat_thumb_images.FILESIZE} | The Filesize in human readable Format, without the Size Identifier (Bytes, KB or MB).
{postrow.attach.cat_thumb_images.SIZE_VAR} | The Size Identifier. Possible Values: Bytes, KB and MB
{postrow.attach.cat_thumb_images.L_DOWNLOADED_VIEWED} | A normal Language Variable, for Thumbnail Images this is 'Viewed'.
{postrow.attach.cat_thumb_images.L_DOWNLOAD_COUNT} | The Download Count, how many Times this Image has been viewed.
{postrow.attach.cat_thumb_images.IMG_SRC} | The Link/Source to the Image. This Link will call the download.php file, for example: download.php?id=12
{postrow.attach.cat_thumb_images.IMG_THUMB_SRC} | The Link/Source to the Thumbnail. This Link will call the download.php file if the download path is not reachable directly.
{postrow.attach.cat_thumb_images.S_UPLOAD_IMAGE} | This is the predefined Upload Image for Attachments within Posts, default: icon_clip.gif If such an upload image is assigned to the extension group the file to be shown belongs to is defined, this image will be displayed instead of the default one. This Variable is not used within this Block.
The complete Layout of the Thumbnail Image Block looks like this:
linux_chick1.jpg
Description: |
A Linux Chick
Filesize: | 53.29 KB
Viewed: | 1 Time(s)
-> The clickable Thumbnail will be displayed here <-
ATTACHROW
<!-- BEGIN attachrow --> <center><hr width="95%"></hr></center> <table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center"> <tr> <td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.attachrow.DOWNLOAD_NAME}</span></b></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td> <td width="75%" class="attachrow"> <table width="100%" border="0" cellpadding="0" cellspacing="4" align="center"> <tr> <td class="attachrow"><span class="genmed">{postrow.attach.attachrow.COMMENT}</span></td> </tr> </table> </td> <td rowspan="4" align="center" width="10%" class="attachrow">{postrow.attach.attachrow.S_UPLOAD_IMAGE}<br /><a href="{postrow.attach.attachrow.U_DOWNLOAD_LINK}" {postrow.attach.attachrow.TARGET_BLANK} class="genmed"><b>{L_DOWNLOAD}</b></a></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILENAME}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.DOWNLOAD_NAME}</span></td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.FILESIZE} {postrow.attach.attachrow.SIZE_VAR}</td> </tr> <tr> <td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.L_DOWNLOADED_VIEWED}:</span></td> <td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.L_DOWNLOAD_COUNT}</span></td> </tr> </table> <center><hr width="95%"></hr></center> <!-- END attachrow -->
The Attachrow Block is for displaying a Download Link to the uploaded File, this is the default behavior for the Attachment Mod and uploaded Files. The following are the defined Variables and their corresponding meaning.
Variable Name | Description
--- | ---
{postrow.attach.attachrow.DOWNLOAD_NAME} | The displayed Download Name, this is the Real Filename.
{postrow.attach.attachrow.COMMENT} | Attachment Comment, the comment the User have entered for this Attachment
{postrow.attach.attachrow.FILESIZE} | The Filesize in human readable Format, without the Size Identifier (Bytes, KB or MB).
{postrow.attach.attachrow.SIZE_VAR} | The Size Identifier. Possible Values: Bytes, KB and MB
{postrow.attach.attachrow.L_DOWNLOADED_VIEWED} | A normal Language Variable, for Attachments this is 'Downloaded'.
{postrow.attach.attachrow.L_DOWNLOAD_COUNT} | The Download Count, how many Times this Attachment has been downloaded.
{postrow.attach.attachrow.U_DOWNLOAD_LINK} | The Link to the Attachment. This Link will call the download.php file, for example: download.php?id=12
{postrow.attach.attachrow.S_UPLOAD_IMAGE} | This is the predefined Upload Image for Attachments within Posts, default: icon_clip.gif If such an upload image is assigned to the extension group the file to be shown belongs to is defined, this image will be displayed instead of the default one.
{postrow.attach.attachrow.TARGET_BLANK} | Depending on the Mime Type of the Attachment, the link will open a new window or not.
The complete Layout of the Attachrow Block looks like this:
acydamp.zip
Description: |
Winamp Skin
| -> Icon <- Download
Filename: | acydamp.zip
Filesize: | 185.08 KB
Downloaded: | 2 Time(s)
## 10. Common Problems attaching Files ### 10.1 Filesize too big / Post Mode not specified / Blank Page If you get Error Messages saying the Filesize is too big after submitting your post, even if you are attaching Files below 1 Kbyte. The most common reason for this error is that your provider has enabled File Uploading on the Server, but he probably have set the Maximum Filesize to 0 Byte. Another reason could be that you are trying to attach a File bigger than the maximum allowed upload size defined by your Provider. The Attachment Mod is unable to overwrite this value. If you are trying to attach very big files the execution time limit may have been exceeded. Here is a list of all PHP Variables interfering directly or indirectly with File Uploading:
max_execution_time memory_limit post_max_size file_uploads upload_max_filesize
Please refer to the PHP Documentation on how to configure this variables. If you get the Error Message 'no Post Mode specified' after submitting your Post or a blank page. The most common reason for this error is that your provider does not allow File Uploads at all. Ask your provider or create a php-file with this content:
<? phpinfo(); ?>
Upload the File to your webspace, execute it and look for the variable 'file uploads', it have to be set to 1, if not, file uploading is not allowed. Additional Informations for both problems: new twist on "No post mode..." problem-Thread posted at Opentools.de. ### 10.2 Could not attach File, but Post has been stored / Filesize is 0 all over the time If you get the Error Message 'Could not Attach File. Post has been stored' after submitting your Post. Either your Provider does not allow the function filesize(), which is very bad, because nothing can be done to solve the problem, or your Temporary PHP Directory is not setup properly. (Only for people hosting their own Website) Every Attachment uploaded to the board will go into the PHP Temporary Upload Directory. Please check the Permissions of this Directory and make sure PHP is allowed to write to it. For users using Apache/IIS on Windows, you might want to check the following Settings: (Thanks to SFGrimoire :: complete thread about this error) The IUSR_hostname account needs to have read/write access to the system temp directory, otherwise you will receive the following access failure:
Event Type: Failure Audit Event Source: Security Event Category: Object Access Event ID: 560 Date: 9/16/2002 Time: 12:05:52 PM User: W2KNCHTNPC\IUSR_W2KNCHTNPC Computer: W2KNCHTNPC Description: Object Open: Object Server: Security Object Type: File Object Name: C:\WINNT\Temp New Handle ID: - Operation ID: {0,450981} Process ID: 812 Primary User Name: W2KNCHTNPC$ Primary Domain: AFS Primary Logon ID: (0x0,0x3E7) Client User Name: IUSR_W2KNCHTNPC Client Domain: W2KNCHTNPC Client Logon ID: (0x0,0x61349) Accesses SYNCHRONIZE ReadData (or ListDirectory) Privileges -
The specific permissions required are:
hostname\IUSR_hostname:(OI)(CI)(special access:) DELETE READ_CONTROL SYNCHRONIZE FILE_READ_DATA FILE_WRITE_DATA FILE_APPEND_DATA FILE_EXECUTE
Also, if you change the upload directory in php.ini the IUSR_hostname account needs the same permissions. ### 10.3 General Error: Could not Attach File This Error is a default Message if something is not setup. To test the various things and give you an appropriate Error Message is too time intensive for a post page, therefore it was placed into the Administration Panel. Go to Adminstration Panel -> Management and click on 'Test Settings', now you should receive a more detailed Error Message, explaining what you have to do in order for the Attachment Mod to work correctly. In most cases you have forgotten to chmod the upload directory. ### 10.4 I am able to attach files in Private Messages, but with normal Posts i cannot Attach files You may have made a mistake while editing your includes/auth.php file, please re-check this file. The line to be added has to be placed AFTER the closing brace, and not Before it. If this was not the error, please check if you have edited and uploaded your posting_body.tpl file. ### 10.5 No Attachments are displayed Since the Attachment Mod Version 2.3.5 a check was integrated to bypass the different viewtopic.php versions users are magically using. But please check if you have added the last line between ); and } within the viewtopic.php file. The correct result for the last line to be added to the viewtopic.php file should look like this:
'U_POST_ID' => $postrow[$i]['post_id']) ); display_post_attachments($postrow[$i]['post_id'], $postrow[$i]['post_attachment']);
## 11. Copyright and Disclaimer This Application (Attachment Mod) is OpenSource Software, released under the GPL. This Document is Copyright © 2003 Acyd Burn, All Rights Reserved. Contributors: Thanks to DareDevil for fixing many grammar and spelling errors.