1 (edited by CodeXP 2005-02-27 17:57)

Topic: Dynamic template mod

##
##
##        Mod title:  Dynamic Template tweak
##
##      Mod version:  1.0
##   Works on PunBB:  1.2, 1.2.1, 1.2.2
##     Release date:  2005-02-27
##           Author:  CodeXP (codexp [at] tasarinan.com)
##
##      Description:  This mod will allow you to use different templates for
##                    your CSS style sheets. The template system will now 
##                    look for *.tpl files prefixed with '<stylename>_'
##                    instead of the deault ones (main.tpl, admin.tpl etc.).
##                    If it can't find any prefixed templates, it will load
##                    the default ones instead.
##                    
##   Affected files:  header.php
##                    include/functions.php
##
##       Affects DB:  No
##
##
##            Notes:  This mod should work with any version of PunBB, but I've
##                    only tested it with the 1.2.x release.
##                    
##                    Example on use: 
##                    - Let's say that you're using Oxygen.css as your default
##                    style with your PunBB forum. Then you make a new style
##                    called "mycoolstyle" that requires you to change something
##                    in one, or all, of the *.tpl files. Doing that would
##                    usually break the layout of the rest of your *.css styles.
##
##                    With this mod, you can just save your new *.tpl files as
##                    'mycoolstyle_main.tpl' (same format for all your *.tpl's).
##                    What now happens is that all your other *.tpl's will use
##                    the ordinary templates, but your 'mycoolstyle' one will
##                    use the new template filenames instead.
##                    If for some reason you're missing one of the new files,
##                    the mod will load the default PunBB one's instead :)
##
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Hi everyone! Here's my first mod ever for PunBB smile

What does it do you ask? Well, first let me give you some background info on *why* I made this:
It started with me wanting to create a new style/theme for PunBB. That part of it was rather easy, but it required me to modify the *.tpl files. That in itself wouldn't be a problem if I was only using the new style. No, the problem occured when you changed to a style that *didn't* need the modifications in the template files (you could say that the layout wasn't quite the same anymore).

Ok then, how does this mod solve anything?
Example:
If you got Oxygen.css selected as your style, PunBB will look for 'include/template/Oxygen_main.tpl etc.. If it finds it, it will ignore the default main.tpl file. If it can't find any new templates that fit this naming scheme, it will revert to using the default *.tpl.

Hope this will be of interest to some fellow PunBB users. Feel free to ask if you have any questions (I'm bad at explaining, I know tongue)

[Download] [Demo]

Edit: Added demo account on my test forum. Login/pass (needed to change style): Test_user / test
- The default style contains several modifications to the default *.tpl's. All the others are using the default styles. As you can see, the modifications to the templates only affects the new style/theme smile

2

Re: Dynamic template mod

Cool! This should be very useful.

3 (edited by CodeXP 2005-02-27 16:49)

Re: Dynamic template mod

graue wrote:

Cool! This should be very useful.

I hope so smile Let me know if you encounter any problems with the installation? It should not be able to break anything at all, but still..

4

Re: Dynamic template mod

Yes !!! great !!!

PunBB was only skinnable by colors ... but with this mod, we can alterate the "hard code" ... interesting !

Re: Dynamic template mod

This is great smile

6

Re: Dynamic template mod

Does this work with 1.2.5?

-gezz

Re: Dynamic template mod

CodeXP wrote:

Notes:  This mod should work with any version of PunBB, but I've only tested it with the 1.2.x release.

Re: Dynamic template mod

gezz wrote:

Does this work with 1.2.5?

Works great with 1.2.5, that's what Im using it with.