First of all you need to have atleast version 3.5.11 of WebTrack.
Then
create a new folder in the plugins folder (the plugins folder can be changed on the "update" page, but default is "plugins" in the root of the WebTrack folder). This new folder in the "plugins" folder will be the name of your plugin and act as the replace tag. If your plugin is called "showstars". Your "replace tag" that you will have to add in the (body) templates will be {PLUGIN_SHOWSTARS}.
Then you need at least two files in your folder. One called "data.txt" and a nother one called "index.php".
Lets start with the data.txt file.
This should be a normal text file. In this file you will add the fields of the data that you want WebTrack to send to your plugin. Start a line with "data=" (you can write anything else in this file starting each line with # and as long as you dont write "data=" anywhere else ofcourse). Then add a number between 0-4 (this is the access needed of the user to "see" the plugin result). If you enter 0 (zero) here all users at all times will see the plugin result. Anything else (1-4) will limit the result. If the user don't have enough access the plugin will only give empty data back (basically your plugin-tag will be replaced with nothing). You can see the different levels on the user management page.
To separate the fields ALWAYS use two pipes ( || ).
Here is a list of available data fields with a shot description below. The order of the fields in your data.txt file does not matter. Remeber some data fields are not "title" specific.
| The data fields are: |
| abitrate |
Audio bitrate. |
| access |
The logged in users current access status (0-4). |
| achannels |
Audio channels used encoding the audio. |
| acodec |
Audio codec used (MP3 mostly). |
| actors |
Actors. |
| ahz |
Audio frequency. |
| akaname |
AKA names of movie. |
| auth |
What type of login system used (0, 1, 2). Set from the "update" page. |
| barcode |
Barcode. |
| bitrate |
Video Bitrate. |
| cds |
Number of CDs. |
| codec |
Codec used (XviD, DivX, whatever). |
| comments |
User comments. |
| country |
Country. |
| cover |
Path and name of the cover picture. |
| coverspath |
Path only to the covers. |
| director |
Director. |
| entrydate |
When the movie was entered in to the Database. |
| filepath |
Path to file or directory entered in the Database. |
| format |
Format (MPEG-1,2,4,5, AVI, whatever...) |
| fps |
Frames / second. |
| genre |
Genre. |
| height |
Height of picture. |
| imdblink |
A link used to "search" IMDB for current movie title. |
| imdbrating |
IMDB User Rating. |
| indir |
The "indir" variable from the "update" page. (1 or 0). |
| lang |
Language. |
| length |
Length of MPGs and/or AVIs in min. |
| linuxfilepath |
If you have specified the replace parts and mount point parts on the update page, this will be the "real" path to the wile for the webserver. |
| loan |
Lists the loan history. |
| location |
Location. |
| medium |
Medium (DVD, CD, whatever..) |
| moviecount |
Current movie list number in current search. |
| mpaa |
The Motion Picture Association of America rating. |
| name |
Title of movie. |
| none |
The "none" variable, used if a field is empty and defined on the "update" page. |
| number |
MT Database unique number. |
| playtime |
Total play time in min (From IMDB). |
| plot |
Plot. |
| pluginsfolder |
The plugins folder (set on the "update" page). |
| producer |
Producer. |
| profile |
Default style profile folder. |
| rating |
MTs rating. |
| serverfileaccess |
If the server have access to the files. The variable from the "update" page. (1 or 0). |
| siteurl |
Your sites full URL (set on the "update" page). |
| size |
Aspect ratio. |
| status |
Status. (Absent / Present) |
| subentry |
Shows multiple episodes if entered. |
| subtitles |
Subtitles. |
| tagline |
Tagline. |
| trailerfolder |
Path to the trailer folder. |
| user |
The username logged in. |
| usernumber |
Your numbering system. |
| views |
Number of times the movie ha been watched (in MT). |
| votes |
Number of votes the IMDb grade is based on. |
| width |
Width of picture. |
| year |
Release year. |
Here is an example for you:
data=3||imdbrating||name||year
As you can see, the user have to have access 3 at least and the fields I want are "imdbrating", "name" and "year".
Thats it. :) Save the file in your plugin directory.
Now to the index.php file.
This file is a normal PHP file. This is the file that WebTrack will execute when the plugin is called. As simple as that. :)
Of course, if you want to retrieve the data that you ordered in your data.txt file (remember?) you need to know how. All the data is stored in a session variable named after your plugin. So again if your plugin directory was called “showstars”, your session variable will be “$_SESSION[“showstars”]”. This session variable will be a string containing your data..
This is a simple code example to retrieve the data and put it in to an array. :)
<?php
// Collects the plugin data from the session.
if (isset($_SESSION["showstars"])) {
$data = $_SESSION["showstars"];
$plugindata = explode("||", $data);
} else {
$plugindata = false;
}
//Your code here!
print_r($plugindata); // Prints out your plugin data
(just remove this row when you start playing).
?>
Your data in the session variable will look something like this for each title:
$_SESSION[“showstars”] = 3||9.7/10||The Matrix||1999
Now all you have to do is start creating.
Remeber to keep all your files needed for your plugin inside your plugin folder (and under folders) to simplify installation for others. Also if you want to share your plugin it's good to have some kind of documentation of course. Just make a text file with some simple information about your plugin and how to install it.
|