Topic: [Style mod] Dynamic TR Hover Effect
##
##
## Mod title: TR hover effect
##
## Mod version: 1.0
## Works on PunBB: 1.2.x
## Release date: 2005-06-05
## Author: CodeXP (codexp@tasarinan.com)
##
## Description: Add a hover effect to the forum and topic list (changes the background).
##
## Affected files: index.php
## header.php
## viewforum.php
##
## Affects DB: No
##
## Notes: With a fully CSS2 compatible browser, you could just have
## used "tr:hover { background-color: <whatever> }" but that
## effect will not work in Internet Explorer.
## This simple hack will add the same effect, just using
## Javascript instead.
## The hack will look for a .php file in your template folder,
## prefixed with your CSS of choice (will only add the hover
## effect if the file exist.
## If you want the effect added for the Oxygen style, create
## and upload a .php file named 'Oxygen_hcolor.php' to your
## 'include/template/' folder.
## If you want to add the effect to the Mercury style, just
## name the .php file 'Mercury_hcolor.php'
## The same naming scheme applies to any style.
## See included example file for more details.
##
## 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.
##
##
#
#---------[ 1. UPLOAD ]-------------------------------------------------------
#
Oxygen_hcolor.php to include/template/
#
#---------[ 2. OPEN ]---------------------------------------------------------
#
header.php
#
#---------[ 3. FIND (line: 37) ]---------------------------------------------
#
// Load the template
#
#---------[ 4. BEFORE, ADD ]-------------------------------------------------
#
// TR hover hack
if (file_exists(PUN_ROOT.'include/template/'.$pun_user['style'].'_hcolor.php'))
@include (PUN_ROOT.'include/template/'.$pun_user['style'].'_hcolor.php');
else
$hcolor = '';
// End TR hover hack
#
#---------[ 5. OPEN ]---------------------------------------------------------
#
index.php
#
#---------[ 6. FIND (line: 127) ]---------------------------------------------
#
<tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
#
#---------[ 7. REPLACE WITH ]-------------------------------------------------
#
<tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?> onmouseover="this.style.backgroundColor='<?php echo $hcolor; ?>'" onmouseout="this.style.backgroundColor=''">
#
#---------[ 8. OPEN ]---------------------------------------------------------
#
viewforum.php
#
#---------[ 9. FIND (line: 208) ]---------------------------------------------
#
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
#
#---------[ 10. REPLACE WITH ]---------------------------------------------------
#
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?> onmouseover="this.style.backgroundColor='<?php echo $hcolor; ?>'" onmouseout="this.style.backgroundColor=''">
#
#---------[ 11. SAVE/UPLOAD ]-------------------------------------------------
#
This is just a simple hack I needed for a style I'm working on. Just thought that perhaps someone else would like it to I first thought of hard-coding the effect into the regular php files, but that kinda messed things up with my other styles. The solution? This little hack.