phpBB has a flexible templating system that has enabled hundreds of additional styles to be created beyond the default subSilver style. However, since it is impossible to account for the differences between all these styles, MODs must be written for default subSilver only. EasyMOD will try to compensate by modifiying other styles when possible, but it is not a perfect system. A convention is needed to provide specifc data on how a MOD should handle individual styles. This section lays out that convention.
The least you need to know:
- Target template variables for FINDs when possibe
- Store all modifications for TPLs in style_xxxxxxx.txt that functions like a mini-MOD
- coversions for new TPL files are stored in the same directory as filename_xxxxx.tpl
Community Effort
Similar to the effort for translating MODs, we as a community will have better luck making MODs available for more styles if we all work together. The hope is that this convention will allow all MODs to work on with more styles with less work needed by the Author. Since the data for making the modifications to styles will be stored seperately from the MOD, others can help the Author by independently porting the MOD to other styles and submitting their work to the rest of the community. There are plans to update the http://www.phpbb.com" target="_blank MODs DB to accept these independ submissions (with the Author's approval).
FIND and TPL files
All MODs are written for the default subSilver style. However you must keep in mind that there are hundreds of styles that have been created for phpBB. Our goal is to be as compatiable as possible with maximum number of styles. Note that full compatiblity cannot be guaranteed with any style other than subSilver unless an explict conversion for the style is included with the MOD.
There are a few tips you can follow to better ensure compatiblity. When possible try to key on the template variables (ie {postrow.POSTER_FROM}) as these will be consistent from style to style. While making sure the line is sufficiently unique, strip out as much HTML as possible that could clash with other styles. For example, class assignments and table definitions are likely to change from style to style so avoid including them in your FIND if possible. Lastly, when inserting text into a TPL be mindful that the text may be inserted into non-subSilver styles. Try to keep the text as generic as possible (and if possible) and this will increase the odds of it working with styles other than subSilver.
MODing existing TPL files
If you need to make a modification to an existing phpBB TPL file, the process is very much like dealing with lang_main.php. All the modifications, for all the TPLs to be edited will be stored in style_xxxxxxx.txt that functions like a mini-MOD. For example, say you need to make a modification to templates/subSilver/viewtopic_body.tpl and you want to make a conversion for the blueGray theme. Inside the directory (or any directory underneath) that the MOD is located in, you will need to store a file called style_blueGray.txt. Inside style_blueGray.txt you will include all the MOD Template commands necessary to tailor this style to work with the MOD. You may also include a header so as to describe the file a bit, but EM does not require it. For example you may have something like this...
Code: Select all
##############################################################
## MOD Title: Country Flags
## MOD Versions: 1.0.0 to 1.2.0
## Style: blueGray
## Rev Date: September 15, 2003
##
## Converter: Nuttzy99 < [email protected] > (n/a) http://www.blizzhackers.com" target="_blank
##
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
templates/blueGray/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
{postrow.POSTER_FROM}</span><br />
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_FROM}</span><br />
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{postrow.POSTER_FROM_FLAG}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
MODs that provide new TPL files
Many MODs must provide new TPL files to utilize the MODs functionality. Under the old convention the files intended for subSilver would simply be copied to all template directories. Fundamentally this would work with no problem as the HTML should be fine for all styles. However it is not optimal because classes or other elements of subSilver may not be consistent with other styles.
With the new convention you need only include a file specific to the desired style in the same directory you are locating the TPL for subSilver. For example if you have a foo.tpl for subSilver, simply include a foo_blueGray.tpl and the file will be copied to the appropriate location in the blueGray directory. The _blueGray from the filename will be stripped off while moving to the new location.
Converted files that are not needed will be ignored. Therefore if a viewtopic_fiSilver.tpl also exists in the directory but the fiSilver style is not installed, then the file is ignored. If fiSilver is installed, but a viewtopic_fiSilver.tpl file is not present in the same directory as viewtopic.tpl, then the subSilver viewtopic.tpl will by default be copied to /templates/fiSilver.