Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: tclane on September 14, 2014, 11:49:45 PM

Title: Where is Sources?
Post by: tclane on September 14, 2014, 11:49:45 PM
I can't seem to find Sources/Subs.php. Where is Sources located?
Title: Re: Where is Sources?
Post by: Burke ♞ Knight on September 14, 2014, 11:54:20 PM
In the root directory of your forum. :)
Title: Re: Where is Sources?
Post by: tclane on September 14, 2014, 11:59:00 PM
How would I get there from Admin?
Title: Re: Where is Sources?
Post by: Burke ♞ Knight on September 15, 2014, 12:09:22 AM
You don't.
Editing files from Admin panel is not recommended.

Use your FTP and an editor on your computer, or even the file manager in your web hosting control panel.
Title: Re: Where is Sources?
Post by: tclane on September 15, 2014, 12:12:57 AM
Okay, thanks!
Title: Re: Where is Sources?
Post by: tclane on September 15, 2014, 12:32:06 AM
Found it, but perhaps I'm looking in the wrong place. If I just need to edit the text of a menu button, where do I do this?
Title: Re: Where is Sources?
Post by: Kindred on September 15, 2014, 12:35:34 AM
Index.english.php in the languages directory under the defaukt themes directory.


Seriously,  instead of asking random questions, why don't you just tell us exactly what you are trying to do and we can direct you to the right place
Title: Re: Where is Sources?
Post by: tclane on September 15, 2014, 12:46:56 AM
Quote from: Kindred on September 15, 2014, 12:35:34 AM
Index.english.php in the languages directory under the defaukt themes directory.


Seriously,  instead of asking random questions, why don't you just tell us exactly what you are trying to do and we can direct you to the right place

Well, I didn't want to ask the same question that I'm sure had been asked 4000 times before, so I decided to search the forum first. (Imagine that!) The post that I read said that you edit the menu in Subs.php. After looking at Subs.php, I realized that what I was looking for wasn't there.
Title: Re: Where is Sources?
Post by: tclane on September 15, 2014, 01:06:54 AM
Okay, I went to Index.english.php. Still nothing. I'm just trying to change the text for the "Home" button and the URL.
Title: Re: Where is Sources?
Post by: Kindred on September 15, 2014, 01:25:52 AM
Once again you seem to be asking you different question each time you write. In order to change the text of the home button you would edit the text string in index. English. PHP. In order to edit the URL you would edit the button action in subs. PHP. Of course why anyone would change the home url to be something else would boggle my mind since you need some way to get back to the main index of the site forum if you wanted to add another button that goes to a different URL then you should do that in subs. PHP
Title: Re: Where is Sources?
Post by: TehCraw on September 15, 2014, 01:37:39 AM
Okay, to change the text displayed, you do need to edit the language file Themes/default/languages/index.english.php, probably around line 95. It looks like this.


$txt['home'] = 'Home';


You can change its value to whatever you want, like so.


$txt['home'] = 'Main Page';


To change the location the main page button links to, you'll need to edit Subs.php. Look for this bit, around lines 3919 - 3926.


'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),


The location the button links to is changed by modifying the 'href' value, where it currently points to $scripturl. Change it like this, assuming you want some page outside of SMF or something.


'home' => array(
'title' => $txt['home'],
'href' => 'http://somewebsite.com/fake-page.html',
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),


Note, also, that 'title' points to $txt['home'], which is the value you changed in the language file. Neat how that works, eh?
Title: Re: Where is Sources?
Post by: Kindred on September 15, 2014, 02:22:40 AM
Carvin,

just so you know... there is a reason why we don't just straight out answer questions which seem to be intended to break very basic functionality...
Title: Re: Where is Sources?
Post by: Chalky on September 15, 2014, 02:24:57 AM
/me wonders whether the "back to index" mod is what is required....
Title: Re: Where is Sources?
Post by: TehCraw on September 15, 2014, 01:54:09 PM
My apologies, Kindred.
Title: Re: Where is Sources?
Post by: tclane on September 16, 2014, 12:42:59 AM
Carvin, thank you for taking the time to walk me through this. Much appreciated.
Title: Re: Where is Sources?
Post by: TehCraw on September 16, 2014, 02:54:51 AM
You're quite welcome. Although, as Kindred was getting at, there's quite possibly a better way to do what you're trying to accomplish. It's usually not a good idea to change the 'href' values of menu buttons to concrete URLs, especially if the page you're linking to exists somewhere on the forum. Further, by not having a home button, getting back to the board index could be interesting and not intuitive.

In the future, if you were to provide details like what you wanted to change about the Home button, we might be able to assist you in a way that would work better with the forum, rather than sort of hacking things in. I'm sure you have a good, logical reason for wanting to modify the Home button, but without mentioning what it is here, the idea sounds like something that would ordinarily be a bad idea.

Anyway I'm glad to have been some help.  :)