Link to home
Start Free TrialLog in
Avatar of winglis4
winglis4

asked on

phpbb mod writing info

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
Avatar of soapergem
soapergem
Flag of United States of America image

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!
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.
Avatar of winglis4
winglis4

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of soapergem
soapergem
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.