Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Rumpa on November 24, 2022, 08:05:23 AM

Title: Tips/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Rumpa on November 24, 2022, 08:05:23 AM
Hello members my first post in this section.
Here i share something which may helpful.

Add Home button in Footer area just below SMF copyright area.

Tips/tricks:


Theme/default/index.template.php

Search
<li class="copyright">', theme_copyright(), '</li>

Add after
                  <li class="last"><a id="button_home" href="', $scripturl , '"class="new_win"><span>', $txt['home'], '</span></a></li>
languagedir/Modifications.english.php

Search
?>
Add before
$txt['home'] = 'Home';
And see the result
(https://i.postimg.cc/K87WZdCv/New-Bitmap-Image.png)

Title: Re: Tip/Trick Add Home Button in Footer Area
Post by: Steve on November 24, 2022, 08:24:21 AM
Before we can approve this, there's just one thing that's missing:

QuoteYou should also add the version number in the title. If it works in more than one version, you can add both.
For example, is this for 2.1.x series or 2.0.x series or both?

I've fixed your post to conform to the other requirements of this board (check the sticky topic).
Title: Re: Tip/Trick Add Home Button in Footer Area
Post by: Rumpa on November 24, 2022, 08:33:07 AM
Quote from: Steve on November 24, 2022, 08:24:21 AMBefore we can approve this, there's just one thing that's missing:

QuoteYou should also add the version number in the title. If it works in more than one version, you can add both.
For example, is this for 2.1.x series or 2.0.x series or both?

I've fixed your post to conform to the other requirements of this board (check the sticky topic).

It's work in SMF 2.1.x i did not test in SMF 2.0
Title: Re: Tip/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Illori on November 24, 2022, 08:38:01 AM
href="', $scripturl , '?home"
as far as i know this url, ?home does not exist in SMF so it would send you back to the home page anyway. so your mod is using code that it does not need to use. it should just go back to the $scripturl. of course if the forum is using a portal this may vary.

also you are not defining $txt['home'] anywhere so the error log will get filled up and your button will not show correctly.
Title: Re: Tip/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Rumpa on November 24, 2022, 08:43:04 AM
Quote from: Illori on November 24, 2022, 08:38:01 AMhref="', $scripturl , '?home"
as far as i know this url, ?home does not exist in SMF so it would send you back to the home page anyway. so your mod is using code that it does not need to use. it should just go back to the $scripturl. of course if the forum is using a portal this may vary.

also you are not defining $txt['home'] anywhere so the error log will get filled up and your button will not show correctly.
But i am using it and no error log there.
yes if forum using portal this may vary.
Title: Re: Tip/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Steve on November 24, 2022, 02:52:26 PM
I removed just the ?home and it works fine for me. Can a coder verify that this is correct without it so we can get this topic approved?
Title: Re: Tip/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Kindred on November 24, 2022, 09:18:19 PM
The use of ?home is wrong,  because it does not exist.

And any txt string needs to be added to modifications.english.php

In other words,  this "tip" is wrong in all sorts of ways.

Rejected.
Title: Re: Tip/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Rumpa on November 25, 2022, 05:35:43 AM
Quote from: Kindred on November 24, 2022, 09:18:19 PMThe use of ?home is wrong,  because it does not exist.

And any txt string needs to be added to modifications.english.php

In other words,  this "tip" is wrong in all sorts of ways.

Rejected.

Modified please check
Title: Re: Tips/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Diego Andrés on November 25, 2022, 06:42:19 PM
Looks good so far.

Quote from: Rumpa on November 24, 2022, 08:05:23 AMlanguagedir/Modifications.english.php

Search
end
Add before
$txt['home'] = 'Home';

Please fix this, there's no end word, could cause confusion.
Use ?>, or simply advice to add it at the end of the file.
Title: Re: Tips/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Rumpa on November 25, 2022, 09:30:21 PM
Quote from: Diego Andrés on November 25, 2022, 06:42:19 PMLooks good so far.

Quote from: Rumpa on November 24, 2022, 08:05:23 AMlanguagedir/Modifications.english.php

Search
end
Add before
$txt['home'] = 'Home';

Please fix this, there's no end word, could cause confusion.
Use ?>, or simply advice to add it at the end of the file.
fixed please check
Title: Re: Tips/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: Steve on November 26, 2022, 07:39:45 AM
Looks like she's got all the problems corrected, any reason not to approve it now?
Title: Re: Tips/Trick SMF 2.1.x: Add Home Button in Footer Area
Post by: live627 on November 26, 2022, 08:08:13 AM
isn't that the same $txt var that the menu uses, which should mean that it is always defined?