UBB.Dev
Posted By: Yakko Warner So many files... I'm confused! - 10/26/2002 8:28 PM
I hate being a newbie, but I guess we've all got to start sometime. Please forgive my ignorance!

I've been running UBB for a while, but I've never made any attempts to modify the code before now. I have programming experience and I can see that you guys have an impressive number of helpful files here as well, so that's all good.

My problem is a very basic one. As I'm thinking about what I want to change on my board (primarily cosmetic stuff), I have no idea what sorts of things would be easy or hard to do. I took a peek at the UBB files to get some idea of how it's all set up, but I am overwhelmed by the sheer number of files, especially cgi files, distributed among all those different directories. I have NO clue what all those files are for.

Is there a page or a thread somewhere around here that can give me a very basic, general breakdown of how UBB is set up? You know, like "this group of files is responsible for this, and that group of files is responsible for that." Basically, I just want to have some idea of what kinds of things would be difficult to change (because they'd require modifying so many files) versus what kinds of things would be easier to change.

I think this question is sounding really convoluted, so I'll just shut up now. Thanks!
Posted By: Charles Capps Re: So many files... I'm confused! - 10/26/2002 9:49 PM
I don't think there's a guide... but there is a pretty easy way to figure out what files you need to look at.

First, determine what you're trying to modify. Take a peek at the URL to this topic. The query string is: ubb=get_topic;f=26;t=002405

You'll want to pay attention to the stuff after ubb= - get_topic.

Open ultimatebb.cgi and search for the string "get_topic"

You'll find a few instances, the last probably being a block that looks something like this:

Code
if ($ubb eq 'get_topic') {
&RequireCode("$vars_config{CGIPath}/ubb_get_topic.cgi");
&get_topic($in{f}, $in{t});
exit(0);
} #end get_topic
So, we know that get_topic causes the ubb_get_topic.cgi to be loaded.

Opening that one up would be your first step to modifying a topic page.

However, this case is a little tricky. The get_topic subroutine does little more than determine if there's a cached copy, then either serves up the cache or makes a new file.

In order to create a new file, it has to do a RequireCode of ubb_lib_posting. lib_posting's create_topic subroutine has most of the magic you're looking to change.

The last step - you need to figure out which template is used by create_topic. Look for a call to &LoadTemplate. In this case, create_topic loads the public_topic_page template.

You can use this same technique to determine which files and templates are involved for any function. Find the call in ultimatebb.cgi, find the file referenced and the sub referenced, then find any further RequireCode or LoadTemplate calls in that sub.

Or, of course, you could just ask. smile

Oh - as there's no ubb= action for the forum summary (the list of cats & forums), the files involved are ubb_forum_summary and public_forum_summary. smile
Posted By: Yakko Warner Re: So many files... I'm confused! - 10/30/2002 10:15 AM
Awesome. Charles, you're great.

I've spent some time playing with the files, and I think I've gotten it pretty much figured out.

So now I have a follow-up question.

It seems that for many types of cosmetic changes, all that's required is to modify the relevant template(s). In some cases, though, that amounts to a lot of templates.

Suppose, for instance, I wanted to move the MainButtonsLine from the right side to the left side. I don't see any easy way around it; I'd have to modify a bunch of templates one at a time, although the change required for each template is extremely minor. Am I understanding this correctly, or am I overlooking something?

So assuming that I do have to modify a bunch of templates, are there any that I can skip over? I've seen it mentioned in various threads that certain templates are no longer in use by 6.3. Off the top of your head, do you know which ones?

I'll post my other random question in a separate thread. smile

Thanks again!!

--Justin
Posted By: Charles Capps Re: So many files... I'm confused! - 10/30/2002 7:57 PM
No, you're (unfortunately) right. The header & footer code is NOT centralized. We plan to fix this the next time we work through the templates, which should be the release after 6.4.

Generally, if a template exists, it's in use. I believe the ones you're refering to are public_register_page and public_register_page_kid, though - those can be nuked...
© UBB.Developers