File/PHPmyBrowser/types.php

Description

List of extensions associated by types, with an icon, a label... to associate an icon and an add-on script for several extensions.

Quick overview

  • have one icon for several files format : better speed, and easy to change.
  • display an accurate label (type column in some templates), "Font" is better than "TTF file".
  • group together various extensions under a same type, and add an add-on for all of these files (e.g. all "web images" - PNG, JPG, GIF - are grouped in 'webimage' type, and the add-on webimage.php handle all of them.

Caution

  • Be careful to not set a type that's an extension.
    • a type called 'php' for all .php, .php3, .inc files is bad.
    • a type called 'prog_php' (like programming language PHP) for .php, .php3, .inc... is right, because there is no .prog_php files.
    So use a precise type name.
  • an extension must be only in one type. If it's in more than one, the first will be takine in account, and the others will be ignored.
  • Be careful of the existence of your icons. A little convention, name with a _ means "an icon for one type" (= several extensions), without _ means "an icon for one extension". (e.g. _font.gif, ttf.gif...).
I wrote a little tool to verify types.php. Run veriftypes.php.

Structure

To add a type, insert

  1. 'NAME_OF_TYPE' => array(
  2. 'label' => 'LABEL_OF_TYPE',
  3. 'icongif' => 'ICON_NAME',
  4. 'add-on' => 'script1|script2|...',
  5. 'extensions' => 'asf|asx|avi|...'
  6. ),
  • extensions are separated by a |.
  • do not add .gif in icongif.
  • if you set icongif to '', it displays the default icon _file.gif which means "unknown format".
  • if an icon avi.gif exist, *.asf and *.asx will use icongif whereas *.avi will use avi.gif.
  • if you want an add-on which handles severals kind of files (e.g. audio, video and text) but you want 3 different types, use the add-on field, and set it to "your_add-on".
  • add-on is optional. By default, the add-on NAME_OF_TYPE is called.
  • you can call several add-ons for a type of file, just write them separated by a |.
  • In the label, an * means to replace it by the extension.

Examples

  1. 'video' => array(
  2. 'label' => 'Video',
  3. 'icongif' => '_video',
  4. 'extensions' => 'asf|asx|avi|...'
  5. ),
will display all *.asf, *.asx, *.avi with ico/_video.gif in your template folder, and 'Video' in type column.

  1. 'video' => array(
  2. 'label' => 'Video',
  3. 'icongif' => '',
  4. 'extensions' => 'asf|asx|avi|...'
  5. ),
will use ico/asf.gif, ico/asx.gif, ico/avi.gif ... if they exist, or ico/_file.gif if not.

  1. 'images' => array(
  2. 'label' => 'Image *',
  3. 'icongif' => '',
  4. 'extensions' => 'bmp|pcx|psd|psp|tiff|tga'
  5. ),
displays 'Image BMP', 'Image TIFF'... use the icons ico/bmp.gif, ico/tiff.gif if they exists and ico/_file.gif if they don't.

Variables
array $tabTypes (line 115)

Set the types of files, with associated icon and add-on script.

For instructions, see the top of this page.

Documentation generated on Sat, 28 Aug 2004 16:53:28 +0200 by phpDocumentor 1.3.0RC3