So what kinds of mods have you guys made for Olympus?

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Post Reply
asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: So what kinds of mods have you guys made for Olympus?

Post by asinshesq »

I've begun to adapt my tabulated survey at topic head mod for phpbb3. That one was a bear to write (especially since I had no idea what I was doing when I wrote it) but now, given that I know a bit more about how to clean up code bloat, and given that phpbb3 seems to do some of the heavy lifting, I am hoping I can keep most of the code in separate pages and only tinker a little with the core phpbb3 code.

Is there anything written somewhere showing modders how to leverage off of phpbb3 features so that we don't need to reverse engineer everything? There are some things that are obvious (like the functions to get variables passed from a template) but I'm guessing I am missing a lot of things that would make my life easier.

Also, I see that the language folder has a subfolder called 'mods'. Does that mean that I can add my own language files without needing to edit a file like lang_main.php? (Is there phpbb3 code that automatically includes any language files in that folder in the script, or do I need to invoke the file somehow?) And what's the technical reason why the coders separated out language files via function (posting versus common for example)? I would have thought that a single place for all language variables is more user friendly.
Alan

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: So what kinds of mods have you guys made for Olympus?

Post by EXreaction »

There was a good page somewhere that explained most of the functions in phpBB3...don't remember where it was though. :(

This wiki is still tiny, but it might help a little:
http://olympuswiki.naderman.de/Main_Page

Yes, it is easy to add a new language file, for example, the language file I am using(so far) in the blog mod I am making goes like this:

Code: Select all

<?php
/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
    $lang = array();
}

$lang = array_merge($lang, array(
// Common
    'BLOG'                        => 'Blog',
    'NO_BLOG'                    => 'The requested blog does not exist.',
    'BLOG_NEED_APPROVE'            => 'A moderator or administrator must approve your blogs before they are public.',
    'VIEW_BLOG'                    => 'View Blog',
    'RETURN_BLOG_MAIN'            => '%sReturn to your main blog page%s',
    'BLOG_AUTHOR'                => 'About the Author',
    'AUTHOR_CONTACT'            => 'Contact & Info',

// View User's Blogs
    'BLOGS'                        => '\'s Blogs',  // Would end up like EXreaction's Blogs

// View single Blog
    'BLOG_SUBJECT'                => 'Blog Subject',
    'BLOG_UNAPPROVED'            => 'Blog Needs Approval',
    'BLOG_REPORTED'                => 'Blog has been reported',
    'BLOG_INFO'                    => 'About the Blog',
    'EDITS'                        => 'Edits',
    'BLOG_POST_IP'                => 'IP Address used to post',

// Edit a blog
    'LOGIN_EXPLAIN_EDIT_BLOG'    => 'You must log in before editing a blog.',
    'EDIT_BLOG'                    => 'Edit Blog',

// Add a blog
    'LOGIN_EXPLAIN_NEW_BLOG'    => 'You must log in before creating a new blog.',
    'POST_A'                    => 'Post a new blog',
    'ADD_BLOG'                    => 'Add a new blog',
));

?>
To include the language entries all you have to do is add this line in your file(replace blog with the name of the file, minus the .php part):
$user->setup('blog');

It usually would go after this code:
// Start session management
$user->session_begin();
$auth->acl($user->data);

Also, one cool thing I learned is that you do not need to add template language output yourself anymore(unless it is something you need to use sprintf() with).

For example, in my lang file I have this:
'NO_BLOG' => 'The requested blog does not exist.',

Now, as long as the php file that is used to parse the page includes the language file(with the $user->setup()) I do not have to declare 'L_NO_BLOG' in the output in the php page to display it on the final page. So just adding 'L_NO_BLOG' in your template is enough to show it on your final page. :)

asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: So what kinds of mods have you guys made for Olympus?

Post by asinshesq »

EXreaction wrote: There was a good page somewhere that explained most of the functions in phpBB3...don't remember where it was though. :(

This wiki is still tiny, but it might help a little:
http://olympuswiki.naderman.de/Main_Page

Thanks...tiny but nonetheless helpful!
Also, one cool thing I learned is that you do not need to add template language output yourself anymore(unless it is something you need to use sprintf() with).

That is very cool (I always hated all the L_ assignments in phpbb2). That along with a few other things (like the get_var way of getting variables passed from a template, the changes in the way to interact with the database that make table updating or inserting much easier and the template conditionals) are described here: http://area51.phpbb.com/docs/coding-guidelines.html

But maybe later on tonight I'll start a topic for modders to say what tricks they have found to make coding with phpbb3 easier (or at least different) from phpbb2. Seems like there should be a single place where people can go to get a leg up on a lot of new information!
Alan

User avatar
Nicholas the Italian
Registered User
Posts: 659
Joined: Mon Nov 20, 2006 11:19 pm
Location: 46°8' N, 12°13' E
Contact:

Re: So what kinds of mods have you guys made for Olympus?

Post by Nicholas the Italian »

asinshesq wrote: Is there anything written somewhere showing modders how to leverage off of phpbb3 features so that we don't need to reverse engineer everything? There are some things that are obvious (like the functions to get variables passed from a template) but I'm guessing I am missing a lot of things that would make my life easier.

What about phpBB3 sourcecode documentation? ;) area51.phpbb.com => documentation
EXreaction wrote:

Code: Select all

// View User's Blogs
    'BLOGS'                        => '\'s Blogs',  // Would end up like EXreaction's Blogs

Where is this used? It seems difficult to be translated. You should use something like "%n/'s blog", which can be turned the other way round: "the blog of %n", that is translable.

asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: So what kinds of mods have you guys made for Olympus?

Post by asinshesq »

Is there a nice clean way of putting mod constants in a separate page rather than cluttering up constants.php? I know I could simply create a new page called something like survey_constants.php and add an include or require statement in whatever core pages us those constants...is that what I am supposed to be doing or is there a cooler way?

Also, when you add your own mod language page as above, can you stick it in the language/en/mods directory or is it supposed to go in the language/en directory? I.e., does $user->setup('[name_of_mod_file]') look in the mods directory as well as the en directory?

If you're supposed stick it in the en directory, what's the mods directory for?
Alan

User avatar
poyntesm
Registered User
Posts: 176
Joined: Fri May 13, 2005 4:08 pm
Location: Dublin, Ireland
Contact:

Re: So what kinds of mods have you guys made for Olympus?

Post by poyntesm »

No you need to specific the directory I think..I use the following to include three files..

Code: Select all

$user->add_lang(array('acp/board', 'mods/garage', 'acp/garage'));

asinshesq
Registered User
Posts: 156
Joined: Fri May 14, 2004 10:32 pm
Location: NYC

Re: So what kinds of mods have you guys made for Olympus?

Post by asinshesq »

Thanks, poyntesm.

You mention this as the way to add language files:
$user->add_lang(array('acp/board', 'mods/garage', 'acp/garage'));
and I see from various phpbb3 files that that is in fact how the core code calls a number of language files (see for example faq.php).

But EXreaction suggest this for one language file:
$user->setup('blog');
and I see that some other phpbb3 files call language files that way (see for example search.php).

What's the difference between calling language files through setup() versus add_lang()?

(I'll look at the code tonight and report back if there hasn't been an answer by then.)
Alan

User avatar
poyntesm
Registered User
Posts: 176
Joined: Fri May 13, 2005 4:08 pm
Location: Dublin, Ireland
Contact:

Re: So what kinds of mods have you guys made for Olympus?

Post by poyntesm »

If my memory servers me $user->setup is defined in includes/session.php and can be used to setup language & style and it also does timezones and such. User specific stuff.

If in your MOD you are trying just to add a language $user->add_lang is clearer about what is actually being achieved.

Multiple ways to skin a Bertie spring to mind :twisted: :twisted:

User avatar
Dog Cow
Registered User
Posts: 271
Joined: Wed May 25, 2005 2:14 pm

Re: So what kinds of mods have you guys made for Olympus?

Post by Dog Cow »

Well I haven't made any useful mods yet. I'm still looking through all the files and trying to learn the code and how it's laid out.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: So what kinds of mods have you guys made for Olympus?

Post by EXreaction »

Nicholas the Italian wrote:
EXreaction wrote:

Code: Select all

// View User's Blogs
    'BLOGS'                        => '\'s Blogs',  // Would end up like EXreaction's Blogs

Where is this used? It seems difficult to be translated. You should use something like "%n/'s blog", which can be turned the other way round: "the blog of %n", that is translable.


It is used in a few places...

One is in the breadcrumbs.

Yes, I guess I could change it...


...changed. :P

Post Reply