Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Krimm on October 24, 2010, 12:12:19 AM

Title: Renaming Item in Main menu
Post by: Krimm on October 24, 2010, 12:12:19 AM
SMF Version -- 2.0 RC3
Theme -- Impulse 2 (http://custom.simplemachines.org/themes/index.php?lemma=2060)

Alright, so I've yet another question for the amazing SMF Support forum! Essentially I've searched on how to rename certain items throughout the forum and for the most part, its served its purpose. I renamed Sub-Forums to Sub-Boards and I found out I could edit any Menu Item I wanted...except My Messages. I've recently attained Filezilla (lolfinally) and am now able to access of the pages and whatnot. Essentially, I'd just like to know how I can rename "My Messages" to "Inbox".

Any and all help is appreciated!
Title: Re: Renaming Item in Main menu
Post by: Joker™ on October 24, 2010, 01:06:09 AM
Sources/Subs.php

change txt string here
'title' => $txt['pm_short'],


Replace that string with your own string and define a new one in
themes\default\languages\Modifications.english.php
Title: Re: Renaming Item in Main menu
Post by: Krimm on October 24, 2010, 01:16:58 AM
Well that's a start but would you be a bit more specific on what I should input? @ @ I'm clueless when it comes to php unfortunately and I'm only beginning to learn Java. Sorry XD
Title: Re: Renaming Item in Main menu
Post by: Joker™ on October 24, 2010, 01:29:01 AM
Like for example, change things like this,

Source\Subs.php
Find:

'title' => $txt['pm_short'],


Replace it with:

'title' => $txt['pm_inbox'],


Now open
themes\default\languages\Modifications.english.php

Find:

?>


Add before:
$txt['pm_inbox'] = 'Inbox';


To see the changes clear site cache from here
Administration Center » Forum Maintenance » Routine
Title: Re: Renaming Item in Main menu
Post by: Matthew K. on October 24, 2010, 01:30:15 AM
Code (Find) Select
            'title' => $txt['pm_short'],
Code (Replace) Select
            'title' => 'Your Text',
Title: Re: Renaming Item in Main menu
Post by: Krimm on October 24, 2010, 01:40:04 AM
Thanks you guys o:

I did it slightly differently though, which explains why I couldn't get it to work initially. I went to Languages > ThemeStrings.english.php and renamed pm_short to Inbox and it worked XD

I didn't know My Messages was defined as pm_short though e-e

Well that wraps it up, thanks again.
Title: Re: Renaming Item in Main menu
Post by: Matthew K. on October 24, 2010, 02:19:58 AM
I'll go ahead and mark topic as resolved then Krimm :)

Glad to see you got it figured out.
Title: Re: Renaming Item in Main menu
Post by: Joker™ on October 24, 2010, 03:30:28 AM
Quote from: Labradoodle-360 on October 24, 2010, 01:30:15 AM
Code (Find) Select
            'title' => $txt['pm_short'],
Code (Replace) Select
            'title' => 'Your Text',
I think your method will put a hard text in the file which is not recommended.

Quote from: Krimm on October 24, 2010, 01:40:04 AM
I did it slightly differently though, which explains why I couldn't get it to work initially. I went to Languages > ThemeStrings.english.php and renamed pm_short to Inbox and it worked XD
That string "pm_short" maybe used at some other places, so i won't recommend you to change predefined strings at all.
Title: Re: Renaming Item in Main menu
Post by: Krimm on October 24, 2010, 09:49:26 AM
hm but isn't it just sort of the same thing as what you're going? pm_short remains the same, however it now displays the string "Inbox".

Basically what I have in ThemeStrings.english.php is:

$txt['pm_short'] = '@Postal';

Won't the variable name, pm_short still be accessible to other codes?
Title: Re: Renaming Item in Main menu
Post by: Joker™ on October 24, 2010, 10:49:41 AM
Quote from: Krimm on October 24, 2010, 09:49:26 AM
hm but isn't it just sort of the same thing as what you're going? pm_short remains the same, however it now displays the string "Inbox".

Basically what I have in ThemeStrings.english.php is:

$txt['pm_short'] = '@Postal';

Won't the variable name, pm_short still be accessible to other codes?
See what i have learnt so far is that use should create a new string instead of changing original one, as the original string might be used at various places. So sometime it make changes at such places also which you might not like :).
Title: Re: Renaming Item in Main menu
Post by: Matthew K. on October 24, 2010, 11:38:51 AM
Yes it does, but why you put strings into language files is so they can be translated. This is mainly a mod standard. And for custom coding, it's not a huge deal to put text in a non-language file.

But yes, the best way is to put it in a language file.
Quote from: Joker™ on October 24, 2010, 03:30:28 AM
Quote from: Labradoodle-360 on October 24, 2010, 01:30:15 AM
Code (Find) Select
            'title' => $txt['pm_short'],
Code (Replace) Select
            'title' => 'Your Text',
I think your method will put a hard text in the file which is not recommended.