News:

SMF 2.0.19 has been released! Please update. Read more.

Main Menu

Where is Sources?

Started by tclane, September 14, 2014, 11:49:45 PM

Previous topic - Next topic

tclane

I can't seem to find Sources/Subs.php. Where is Sources located?

Burke ♞ Knight

In the root directory of your forum. :)

tclane

How would I get there from Admin?

Burke ♞ Knight

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.

tclane


tclane

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?

Kindred

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
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

tclane

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.

tclane

Okay, I went to Index.english.php. Still nothing. I'm just trying to change the text for the "Home" button and the URL.

Kindred

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
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

TehCraw

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?
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

Kindred

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...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Chalky

* Chalky wonders whether the "back to index" mod is what is required....

TehCraw

Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

tclane

Carvin, thank you for taking the time to walk me through this. Much appreciated.

TehCraw

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.  :)
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

Advertisement: