?
Solved

phpbb mod writing info

Posted on 2006-05-23
6
Medium Priority
?
446 Views
Last Modified: 2008-02-01
Hey all,
I'm about to start my first mod for the phpBB forum package. I've got it all planned out, but can't seem to find any good info on how the darn thing should work. ie. how language vars become get from the lang_main.php file to the view_profile.php file into the profile_whatever.tpl template file - you get the idea...

Anyone know of a tutorial or info on the code flow or how the heck to get started? I feel my php is solid enough to do what I am wanting out of this mod, I just need a road map of the phpBB package.

Thanks in advance,
winglis4
0
Comment
Question by:winglis4
  • 4
  • 2
6 Comments
 
LVL 6

Expert Comment

by:soapergem
ID: 16748504
You kind of just start doing it. I've written many, many MODs for phpBB myself, and I've come to really love some of the structures they use. Although there are a number of things they could have done better, overall I like it. There really aren't any good tutorials I know of; you kind of just have to dive in and get your hands wet. If you don't have some web space already, find yourself some free or cheap hosting to run a "test forum" on. And *always* try out your MODs on a test forum, or a forum that you don't care about, because if you screw something up on a forum that matters, people will let you know. Very quickly. Many times.

The way that the language files themselves gets loaded is kind of obfuscated, but I wouldn't think that would be important in many cases. What exactly are you trying to do?

But let me see if I can offer any words of wisdom:
1. phpBB uses template classes very heavily. You really have two functions that output stuff:
assign_vars() and assign_block_vars()

The former is for just placing variables on the page, the latter can be used for repeating multiple things (they can be different of course). This can be nested as well. If that doesn't make sense, I can go into much more detail for you.

2. If you write any text at all, and if you plan on having this MOD be validated, you must put it in the appropriate language file. Text, or even HTML (with some exceptions) should not be in any of the PHP files. Text is for the language files, HTML is for the template files.

There are many, many other things I could go over if you're lost. Maybe refine your question a bit? One reference that I consult very frequently is this website:
http://www.phpbb.de/doku/xref/nav.html?_functions/index.html

Although it is a german domain name, the website itself is in English. That contains documentation on all the functions, variables, etc. that are used in the backend of phpBB. Hope that helps!
0
 
LVL 6

Expert Comment

by:soapergem
ID: 16748524
Correction: it's not really "documentation" as much as it is just reference material. It lets you know *exactly* where everything is used and defined so that you can see for yourself how things work. Again, just dive in and start programming. Oh, and one last word of advice: the people on the MOD team are unbelievably slow. It usually takes months for them just to let you know that they've rejected your MOD. You can probably expect your MOD will be rejected the first time you send it in, but they offer a lot of helpful feedback and will tell you exactly what you need to do to make it work or be up to their standards.
0
 
LVL 5

Author Comment

by:winglis4
ID: 16750723
Thanks for that link. What I'm trying to create is a mod that is very similar to XData - to add new fields to the user profile - but more specific and less complex than XData. I'm wanting to add about 20 custom fields so a user can enter info about their PC in the edit Profile page- case, mobo, gfx card, etc. And have it display in the view profile page. I'm playing around with XData (aka Custom Profile Mod) now, but the Group Admin section seems broken (errors out) and the display of info isn't quite what I want it to be.

If I may pick your brain a bit, as an example, say I want to add an image to the View Profile page - an icon for the Rig Info section. I put the icon_rig.gif in 'templates/subSilver/images' folder, in my 'templates/subSilver/profile_view_body.tpl' I put {RIG_IMG} where I want it to appear, then which files would I need to edit to assign it to a var and make it show up there (aside from the .tpl of course)? Thanks again - I can link to a mock-up image of what I'm trying to do if my description is less than clear, lol.

winglis4
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Accepted Solution

by:
soapergem earned 2000 total points
ID: 16751918
Ah, adding things to the user profile. A very common sort of MOD. Okay:

1) All English words go in lang_main.php
2) All HTML go in the appropriate subSilver .tpl file
3) Images go in either templates/subSilver/images, or templates/subSilver/images/lang_english (if they have text)
4) The file names declaring where these images are located go in the $images array, which is declared in subSilver.cfg. For instance, you could add a line like $images['user_rig'] = "$current_template_images/rig.gif"; to this config file
5) For your example--editing the user profile information--you'd have to MOD the includes/usercp_register.php file, and somewhere arround lines 1100 - 1200 (I think that's about where it starts assigning template vars), you'd add a line like this (in order to push it to the template):

      $template->assign_vars(array(

//  lots of other vars here

            'RIG_IMG' => $images['user_rig'],

//  lots of other vars here

      );
0
 
LVL 5

Author Comment

by:winglis4
ID: 16757447
Awesome! I just had to do what you suggested, plus one more step; turn $images['user_rig'] into a local var $user_rig_img that included the <img src="  etc to make it an image instead of the text.

Thanks so much!

I wish there was a site somewhere run by an experienced phpbb modder where newb mod writers could get their hand held for a while - until they are ready for the training wheels to come off (hint?).

winglis4
0
 
LVL 6

Expert Comment

by:soapergem
ID: 16757841
Such a site would be really nice, but we're all too lazy, probably. Trust me--if you get a MOD released in the MODs database, you'll have your hands full providing support for it. Since people come up with MODs in their spare time for no cost, and since the support topic for each MOD can sometimes get littered with the "I INSALLED T AND IT DIDNT WRK"-sort of posts, by the end of the day I don't imagine most MOD writers have the initiative left to write extensive tutorials or documentation. I realize that's a really crappy response for you, sorry, but that's kind of how it is. Feel free to e-mail me if you ever want any suggestions on anything you're working on, though (my username, shown above, at gmail). And maybe after writing a MOD or two, you could start such a site yourself! You could just set up a forum for it.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question