present discussions with an icon or picture, in the list [message #167631] |
Sat, 11 August 2012 11:38 |
|
Atomicrun
Messages: 54 Registered: November 2010 Location: Lund
Karma:
|
Member |
|
|
I run a forum, where the subject is photos and video. To make it more easy to find the right thread, the first message can contain a picture, that is displayed in the list of discussions. This is merely a simple hack, but it make is a lot easier to find the right thread.
Exact list: The "forum" listings don't have icons/pictures. Only the "Topic" listing has icons.
1) a new directory "icon" is created.
2) some pictures, that has the proper dimensions, is installed.
This is an ordinary HTML directory.
We now need to load the picture into the listing.
3) The "Topic Description:" field, of the first post in the thread, may include a "tag", to specify which icon/picture to load. I use this tag: "%pic_" followed by a file name. The tag translates into "icon/pic_" followed by the same name.
4) The translation is by:
$r[22] = preg_replace( '#%pic\_([0-9a-zA-Z_\-\.]+)#si',
'<br /><img src="icon/pic_\\1" alt="" />', $r[22]);
that is inserted in file "thread.php.t", just after the "do {", that you find at approx line 72.
The "themes" must be updated for the change to take effect.
There can be better formatting of the picture, but this works and display a picture.
5) You need to be an administrator to upload a new jpg into the icon directory. There is also no listing, unless you use the admin file-manager, or have a local hard-drive copy.
6) The picture tag can be seen on the page, when the thread is opened.
7) The backup script is updated with the icon directory:
file /adm/admdump.php,
among
backup_dir($DATA_DIR, $fp, $write_func, 'DATA_DIR');
backup_dir($WWW_ROOT_DISK .'images/', $fp, $write_func, 'WWW_ROOT_DISK', 1);
backup_dir($WWW_ROOT_DISK .'adm/', $fp, $write_func, 'WWW_ROOT_DISK');
I insert one new directory:
backup_dir($WWW_ROOT_DISK .'icon/', $fp, $write_func, 'WWW_ROOT_DISK');
I have found no corresponding list of directories, in the script that installs a backup. (I also have not tested the backup script/install procedure.)
So, that leaves us with showing interested readers what it looks like. To our ADMIN I wish to point out, that this is now a natural thing to do, and kindly note that I be as careful as I can, here, and put the link in fine print. But to be of use, the link must also work.
http://www.tufavideo.net/index.php?t=thread&frm_id=17
|
|
|