SMF code - Is it just me or they are nuts over there?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

SMF code - Is it just me or they are nuts over there?

Post by Oren »

Here is some of the SMF code:

Code: Select all

function template_menu()
{
	global $context, $settings, $options, $scripturl, $txt;

	// Show the [home] and [help] buttons.
	echo '
		<a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
		<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

.
.
.

}
Now here is my question:

Is there a reasonable reason as to why each time they print a link, they check $settings['use_image_buttons'] instead of checking it only once and then print the data accordingly?

I don't know, maybe there is some good reason that the ones who are more familiar with SMF aware of. Otherwise, I would have to say that the SMF programmers are nuts :?

Edit: I hope this is the right forum :P
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

The code looks pretty old school. The certainly could use one if(). It is probably jsut cruft. Globals ... yuck.
(#10850)
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

arborint wrote:The code looks pretty old school. The certainly could use one if(). It is probably jsut cruft. Globals ... yuck.
Yeah, exactly what I thought, but I had to make sure and double check before I decide not to go with SMF just because of few lines.
The problem is, what forum should I go with? I check all the big ones and again and again I get frustrated from their crappy code :roll:
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

FUDForum is rumored to be very solid codebase. Haven't seen it personally, though.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Weirdan wrote:FUDForum is rumored to be very solid codebase. Haven't seen it personally, though.
Thanks, I'll check it out.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Form my brief look at the Vanilla code base, it too looks quite solid, even if it is lacking comments.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I've been using Vanilla, and note that Vanilla is also lacking features. Although... much of it can be alleviated by plugins. I've had trouble, however, trying to understand their architecture (but it's probably just me).
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Thanks for your replies guys. I tried FUDForum and Vanilla... I think I will be using Vanilla, but now I'm not sure after reading Ambush Commander's post.
Any other comments about Vanilla?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

A few more comments then. Vanilla doesn't have formatting built-in: i.e. no BBCode or nothing. It's real easy to add it in, but it does say something about the developer's mindset: absolute simplicity. The layout is very spiffy and degrades reasonably without CSS (although it could have been better). By default, people have to "apply for membership", which probably does help against spambots but also can be quite a turn-off to new members, here's quote:
This membership application form does not grant immediate access to the site. All membership applications are reviewed by an administrator before acceptance. You are not guaranteed access to the application by filling out this form.
You can make registration automatic with a quick setting change, but I still need to change that extremely unfriendly message.

Finally, there's an interesting de-emphasis of categories in favor of "all topics." The default view will lead you to an all discussions page, and you have to actually click "Categories" to browse the categories.

That's about all I have to say.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

UseBB looks like a decent forum (for use, I haven't seen the code base). I know there have been several threads about forum software and a lot of people have offered several suggestions on forum software within those threads.
Post Reply