The Five-Minute Forums

The Five-Minute Forums (http://www.fiveminute.net/forums/index.php)
-   5MV Talk (http://www.fiveminute.net/forums/forumdisplay.php?f=7)
-   -   About the (eventual) skin (http://www.fiveminute.net/forums/showthread.php?t=949)

PointyHairedJedi 01-20-2006 01:02 AM

About the (eventual) skin
 
I was just thinking, it would be really cool Zeke if you created five different skins for the board that are all the same bar the ship that appears in the top left hand logo deely. Being able to pick which series you want displayed would be very very nice indeed, and not all that much work, surely?

KillerGodMan 01-20-2006 03:23 AM

There's an idea, because let me tell you, I'd much rather have the Enterprise D or E than the NX-01

Zeke 01-20-2006 04:39 AM

I've had this idea before. The bad news is, it won't work. The good news is, I have another idea which might.

The thing about skins is that each one has its own folder of .tpl files which are templates for the various pages. That means that every time I make a modification to the forums -- the suggested gender mod, for example -- I have to edit the relevant .tpl files in both of our current skins. Those files aren't quite identical, so I have to edit and upload them separately just to be safe. You see the problem: if we had a skin for every ship you guys might want in the forum logo, maintenance would become a nightmare.

However, I think there's another way to do it. What I can do is add another field to the user profile allowing you guys to choose from various logos. Based on your choice, the forum header template could then load the appropriate logo (as long as you were logged in). That would be more work than the gender mod, but I think I could do it.

A simpler alternative would just be to make a bunch of logos and make the selection random. I might try that first.

Chancellor Valium 01-20-2006 08:52 AM

Ooh! I like the second one! Can one of them be a salmon?
:D

mudshark 01-20-2006 02:07 PM

^ The Salmon of Doubt?

Sa'ar Chasm 01-20-2006 03:49 PM

^ I wouldn't think so. Seems kinds fishy.

Zeke 01-20-2006 03:52 PM

Quote:

Originally Posted by mudshark
^ The Salmon of Doubt?

Attaboy. If you're gonna pun, do it Gently.

Sa'ar Chasm 01-20-2006 04:40 PM

ARRRRGH!

Stealth puns. You never see them coming.

Chancellor Valium 01-20-2006 05:07 PM

Quote:

Originally Posted by Zeke
Quote:

Originally Posted by mudshark
^ The Salmon of Doubt?

Attaboy. If you're gonna pun, do it Gently.

You never do detect these things until it's too late.

It's holly iritating.

Sa'ar Chasm 01-20-2006 05:23 PM

Zeke's the master of the stealth pun. He's a bit of a dirk that way.

Chancellor Valium 01-20-2006 08:47 PM

Quote:

Originally Posted by Sa'ar Chasm
Zeke's the master of the stealth pun. He's a bit of a dirk that way.

Gently does it! You don't want to offend him...

Sa'ar Chasm 01-20-2006 09:40 PM

We've done that one already.

If he does get offended, he can go drown his sorrows in a gin sea.

e of pi 01-20-2006 10:03 PM

The puns! They burn! But in a good way!

whoiam 01-20-2006 11:52 PM

Quote:

Originally Posted by Zeke
I've had this idea before. The bad news is, it won't work. The good news is, I have another idea which might.

The thing about skins is that each one has its own folder of .tpl files which are templates for the various pages. That means that every time I make a modification to the forums -- the suggested gender mod, for example -- I have to edit the relevant .tpl files in both of our current skins. Those files aren't quite identical, so I have to edit and upload them separately just to be safe. You see the problem: if we had a skin for every ship you guys might want in the forum logo, maintenance would become a nightmare.

However, I think there's another way to do it. What I can do is add another field to the user profile allowing you guys to choose from various logos. Based on your choice, the forum header template could then load the appropriate logo (as long as you were logged in). That would be more work than the gender mod, but I think I could do it.

A simpler alternative would just be to make a bunch of logos and make the selection random. I might try that first.

Sorry I didn't butt in sooner, but wouldn't it be possible to create the extra folders for the alternate layouts, and just redirect the requests for .tpl files through the strategic use of mod_rewrite and a .htaccess file?

Or, better yet, I know there are ways to use a php file to dynamically select the image that gets displayed... say that you add one field to each user's profile where they select which ship they'd like to see, and then point the layout at a php script for displaying the pic they'd chosen?

*is gonna try making that one himself*

KillerGodMan 01-21-2006 05:40 AM

^You do that, I'll be in that corner moping because I had NO idea what you just said

whoiam 01-21-2006 05:53 AM

okay, I'll try again..

php - the scripting language that this forum is written in - typically has the ability to manipulate images built into it. It is possible to create a php script which you can call as an image file, and which will just return an image when called.

I use one such script to make thumbnails for my photo gallery.

The point is, that you could set the image to link to one of these scripts instead of to an actual file, and you could have the script look up with ship the person in question prefers, and send out the correct image file for that person. Only one style, a slight modification to the database, a slight modification to the signup and profiles pages, and 1 fairly straightforward php script and you're laughing.

Chancellor Valium 01-21-2006 08:50 AM

Quote:

Originally Posted by Sa'ar Chasm
We've done that one already.

I know, but I couldn't think of another :)

Besides, Zeke is hoarding all the puns in caverns measureless to man...

Zeke 01-21-2006 10:11 AM

Quote:

Originally Posted by whoiam
Sorry I didn't butt in sooner, but wouldn't it be possible to create the extra folders for the alternate layouts, and just redirect the requests for .tpl files through the strategic use of mod_rewrite and a .htaccess file?

I've never heard of mod_rewrite, and I've heard of .htaccess but I have no idea what it is. I would need to do research before I'd even understand this idea.

Quote:

Or, better yet, I know there are ways to use a php file to dynamically select the image that gets displayed... say that you add one field to each user's profile where they select which ship they'd like to see, and then point the layout at a php script for displaying the pic they'd chosen?
That sounds exactly the same difficulty as the idea I posted, so I'll try mine first. Thanks for the advice, though.

whoiam 01-21-2006 03:04 PM

mod_rewrite's an apache module for doing slightly more complicated redirects - for instance, redirecting every url containing '.tpl' to a different folder.

.htaccess is a 'supplementary' configuration file for apache that sits in the directory it's meant to affect.

I'm going to modify one of the test forums I keep to try and get the dynamic image generator working, if you want to give that mod a try, let me know.

whoiam 01-21-2006 04:58 PM

Okay, I just spent awhile sketching out the first half of an idea...
(this needs mod_rewrite - ask your host if that's available)

First up, the two example files I made you can find at http://thirdcursus.com/partial-mod.zip

Now, the way I made this section of the mod work is to move all the contents of the /templates/<templatename>/images/ folder to a new folder (I used /templates/<templatename>/target/ when I was writing it). Then edit the .htaccess file so that it contains the proper URL for the folder you moved the images to. (There's only one URL in the file, so just change that to the URL you've used), and place it in the now-empty images folder.

Next, you need to edit the spic.php file. The 6 variables at the top will need to be replaced with ones that will allow read access to the phpbb_users table (or whatever you named your equivalent).

The first variable ($field) needs to be set to the field in the users table that will be used to store the person's choice of picture. the second, $default, is the picture you want someone to see if they haven't made a selection yet.

The spic.exe file then goes into the 'target' folder along with the images.

This system also needs you to add one field to the user table (remember to allow this to be null, or you'll have to modify the signup process as well), and to modify the profile page to allow people to chose options from a drop-down box to go into that field.

*grins* That was an hour well-wasted, I think.

Anyway, this is the code from the two files, feel free to play around with it.

Quote:

Originally Posted by .htaccess
Options All
RewriteEngine on
RewriteRule ^(.*)/?$ http://www.thirdcursus.com/forum/templates/subsilver/target/spic.php?file=$1 [R=301,L]

Quote:

Originally Posted by spic.php
<?php
$field = "replace_me";
$default = "defaultpic.gif";
$hostname_con1 = "localhost";
$database_con1 = "forum";
$table_con1 = "phpbb_users";
$username_con1 = "root";
$password_con1 = "xxx";

// File
$filename = $_GET['file'];


if (eregi ("logo_phpbb.gif", $filename)) {

define('IN_PHPBB', true);
$phpbb_root_path = '../../../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);

$user = $userdata['user_id'];

$con1 = mysql_connect($hostname_con1, $username_con1, $password_con1) or trigger_error(mysql_error(),E_USER_ERROR);

$query_Recordset1 = "SELECT `$field` FROM `$table_con1` where `user_id` = '$user'";
$Recordset1 = mysql_query($query_Recordset1, $con1) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$filename = $row_Recordset1[$field];
if($filename=='') { $filename = $default; }
// Content type
header('Content-type: image/gif');

// Load
$source = imagecreatefromgif($filename);

// Output
imagegif($source);

}elseif (eregi ("\.jpg", $filename)) {

header('Content-type: image/jpg');

// Load
$source = imagecreatefromjpeg($filename);

// Output
imagejpeg($source);

}elseif(eregi ("\.gif", $filename))
{
// Content type
header('Content-type: image/gif');

// Load
$source = imagecreatefromgif($filename);

// Output
imagegif($source);
}elseif(eregi ("\.htm", $filename)) {
include('index.htm');
}
?>



All times are GMT. The time now is 03:55 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.