PDA

View Full Version : [REQUEST] Different "Showthread" template based on forumid


Rose
03-31-2003, 01:26 AM
Hello all!

I am requesting something that should be rather simple, but I've not figured out how to do it. I'm wanting threads in a certain forum to look different than other forums. I've installed Firefly's "Change Style of First Post" hack which is doing most of what I need to be done. This hack calls a separate template "postbit_first" for all threads in the forum I specified.

(note - Yes, I know this hack applies to only the first post in the thread, but I don't imagine any threads will be longer than one post, so it works)

What I would like to do is call a separate showthread template based on forumid.

I looked into editing FIrefly's hack to make it work myself, but I don't think I quite understand how to do it alone.

filburt1
03-31-2003, 01:28 AM
If I'm concious tomorrow during school I'll try making an admin CP based way of doing it, but remember the bit templates will be the same too. showthread is only the container for the bits like postbit.

amykhar
03-31-2003, 01:29 AM
Rose, if you don't have a lot of different styles, what about creating a custom style for the forum and then modifying the showthread template for that style? You can force the forum to use the style and it makes life pretty darn easy.

Otherwise, it's just a matter of finding the code in showthread.php that evaluates the showthread template and putting an if clause around it. (and any of the other sub-templates if you need them different as well)

Amy

filburt1
03-31-2003, 01:30 AM
With vB3's inheritable templates it should be reasonably easy, too, with Amy's method, although if your board has a ton of styles it'll be hell.

Rose
03-31-2003, 01:31 AM
Today at 09:29 PM amykhar said this in Post #3 (https://vborg.vbsupport.ru/showthread.php?postid=375756#post375756)
Rose, if you don't have a lot of different styles, what about creating a custom style for the forum and then modifying the showthread template for that style? You can force the forum to use the style and it makes life pretty darn easy.

Otherwise, it's just a matter of finding the code in showthread.php that evaluates the showthread template and putting an if clause around it. (and any of the other sub-templates if you need them different as well)

Amy

D'oh! Because I didn't even think of that. I generally use the same template set for all styles, but I think I'll give this a try. In fact, I'll work on it right now. But Filburt, if you get what you were going to do done I'd be interested, too.

Brad
03-31-2003, 03:58 AM
This is ugly, and not tested, but you can try something like:

in showthread.php find:

eval("dooutput(\"".gettemplate("showthread")."\");");

Replace with:

if ($forumid==*custom forum id number here*) {
eval("dooutput(\"".gettemplate("showthread_custom")."\");");
} else {
eval("dooutput(\"".gettemplate("showthread")."\");");
}


you'll need to replace *custom forum id number here* with the forum you want to have a new showthread template displayed for. And create a showthread_custom template, Also you will have to do something like this for all the bit templates if you want more custimization.

if you want to do this with multiple forums, showing the same custom template, do this.

if ($forumid==*custom forum id number here* or $forumid==*anthor custom forum id*) {
eval("dooutput(\"".gettemplate("showthread_custom")."\");");
} else {
eval("dooutput(\"".gettemplate("showthread")."\");");
}


or if you want multiple forums to display multiple custom templates do this:

if ($forumid==*custom forum id number here*) {
eval("dooutput(\"".gettemplate("showthread_custom")."\");");
} elseif ($forumid==*anthor custom forumid number here*) {
eval("dooutput(\"".gettemplate("showthread_custom2")."\");");
} else {
eval("dooutput(\"".gettemplate("showthread")."\");");
}

Rose
03-31-2003, 11:52 AM
Thanks, Brad! :D I spent a while working on it last night until the host decided to go down - that usually means its bedtime anyway. For the purposes I need, I think Amy's idea will work grand. But I've made note of your changes so I might use them in the future, probably near future. *hehe*

Thanks again, all! If everything works right, I'll have a pretty neat hackless(ish) gallery for my members.