Skip to main content
Topic: Footer links (Read 4067 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Footer links

I tried to add a link to a thread into the footer right after the credits link. Can anyone help me please?

Code: [Select]
function template_body_below()
{
global $context, $txt;

echo '
</div>
</div>';

// Show RSS link, as well as the copyright.
// Footer is full-width. Wrapper inside automatically matches admin width setting.
echo '
<div id="footer_section"><a id="bot"></a>
<div class="wrapper">
<ul>
<li class="copyright">',
theme_copyright(), '
</li>',
!empty($context['newsfeed_urls']['rss']) ? '<li>
<a id="button_rss" href="' . $context['newsfeed_urls']['rss'] . '" class="rssfeeds new_win"><i class="largetext fa fa-rss"></i></a>
</li>' : '',
'</ul>';

// Show the load time?
if ($context['show_load_time'])
echo '
<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>';
}

Re: Footer links

Reply #1

I guess, a link in the footer has to be added somewhere here:            

Code: [Select]
theme_copyright(), '
</li>',

That way:

Code: [Select]
theme_copyright(), '
</li><a href="http://something.de">| Text</a>',

But I am not sure O:-)

Last Edit: May 15, 2018, 07:00:26 am by Ruth

Re: Footer links

Reply #2

You were absolutely right, thanks!  :)

Re: Footer links

Reply #3

It may not matter, but just to put the idea out there.  The SimpleAds mod does footer ads.  You can place html links as an "ad" right where you're proposing.  Best of all it's hook based, so no keeping up with hardcoded mods.   ;)  Take a look at bbs.zuwharrie.com as an example.   ;D

Re: Footer links

Reply #4

The correct way of doing it would be:
Code: [Select]
function template_body_below()
{
global $context, $txt;

echo '
</div>
</div>';

// Show RSS link, as well as the copyright.
// Footer is full-width. Wrapper inside automatically matches admin width setting.
echo '
<div id="footer_section"><a id="bot"></a>
<div class="wrapper">
<ul>
<li class="copyright">',
theme_copyright(), '
</li>
<li>
<a href="http://something.de">| Text</a>
</li>',
!empty($context['newsfeed_urls']['rss']) ? '<li>
<a id="button_rss" href="' . $context['newsfeed_urls']['rss'] . '" class="rssfeeds new_win"><i class="largetext fa fa-rss"></i></a>
</li>' : '',
'</ul>';

// Show the load time?
if ($context['show_load_time'])
echo '
<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>';
}
Ruth's suggestion omits the <li> tags, which will invalidate the markup. ;)
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Footer links

Reply #5

O_O
OMG a ghost.
Bugs creator.
Features destroyer.
Template killer.


Re: Footer links

Reply #7

Give the <li> a class "copyright":
Code: [Select]
					theme_copyright(), '
</li>
<li class="copyright">
<a href="http://something.de">| Text</a>
</li>',
Bugs creator.
Features destroyer.
Template killer.

Re: Footer links

Reply #8

Thank you!  :)

I did it that way now, because the  | were getting too small or too large, if they are anywhere else:

Code: [Select]
	theme_copyright(), '
</li>
<li class="copyright"> | <a href="http://something.de">Text</a></li><li class="copyright"> | <a href="http://something2.de">Text2</a></li>',
Last Edit: May 23, 2018, 05:08:44 am by Ruth

Re: Footer links

Reply #9

Thanks, Ruth. Works perfect and looks good!

Re: Footer links

Reply #10

A little hint, thanks to @radu81: If you are using complete URLs like https://forum-alternative-antriebe.de/index.php/index.php/topic,467.0.html guests or other not logged in users must click two times on the links to open them. The first click only leads to board index. Strange!

When you change the URL to ' . $scripturl . 'index.php/topic,7255.0.html, everything works fine even with the first click!

So my code looks like this now:

Code: [Select]
	// Show RSS link, as well as the copyright.
// Footer is full-width. Wrapper inside automatically matches admin width setting.
echo '
<footer id="footer_section"><a id="bot"></a>
<div class="wrapper">
<ul>
<li class="copyright">',
theme_copyright(), '
</li>
<li class="copyright"> | <a href="' . $scripturl . 'index.php/topic,467.0.html">Nutzungsbedingungen</a></li>
<li class="copyright"> | <a href="' . $scripturl . 'index.php/topic,7773.0.html">Datenschutzerklärung</a></li>
<li class="copyright"> | <a href="' . $scripturl . 'index.php/topic,7255.0.html">Impressum</a></li>',
!empty($context['newsfeed_urls']['rss']) ? '<li>
<a id="button_rss" href="' . $context['newsfeed_urls']['rss'] . '" class="rssfeeds new_win"><i class="icon icon-margin i-rss icon-big"><s>' . $txt['rss'] . '</s></i></a>
</li>' : '',
'</ul>';

Re: Footer links

Reply #11

Have you tried to change those links with something like index.php?topic=xx? 
sorry for my bad english

 

Re: Footer links

Reply #12

Without leading "scripturl"?

Re: Footer links

Reply #13

Probably $scripturl includes already index.php. :P
Code: [Select]
<a href="' . $scripturl . '?topic=467.0"
would do.
Also, try to always use the above schema, because it is rewritten into the "html" form before being sent to the user and is more "future-proof" (i.e. if something will change in the future, the ?topic form will be for sure properly handled, the "topic,123.0.html" may or may not).
Bugs creator.
Features destroyer.
Template killer.

Re: Footer links

Reply #14

Thank you. I changed the code.  :)