Customizing SMF > Tips and Tricks

Logo with link to (any) homepage

(1/5) > >>

TheCore:
When the Forum is part of another Homepage, some of us like to incorporate a link back to the Homepage.
The solutions I found was rather complex and involved some mods. I like faster and more dirty
solutions, like this one, making that linked logo available anywhere in the Forum tree.
I assume you know as good as nothing, so I add some details you may skip if you know your
way around.

Most have the Forum installed as a subdomain of MYSite.com (like: forum.MYSite.com)
You'll figure that out I guess. It's normal to have the directory "Forum" (or what you call it) in
your public_html directory, or folder as the Mac'ers call it - where your Homepage content is.

First, upload your logo to the Theme images folder.
It's located something like this: MYSite.com/Forum//Themes/MYTheme/images/MYLogo.jpg

Next, login as forum Admin and add your logo to the Header.
You do this in: Configuration>Current Theme>Themes and Settings by adding
the path into the Logo image URL field like this:
forum.MYSite.com/Themes/MYTheme/images/MYLogo.jpg
If you see the logo in the head after "Save" you are close to genius. IQ rules. (luck too).

Now we add a link to that logo so users can jump from
forum.MYSite.com to your Homepage MYSite.com
with a click on the logo.

Do this:
On that same setup page: (Configuration>Current Theme>Themes and Settings),
at the top is a link saying: Modify the index template. (the main template).
Stare at it - and then Click on it. The Edit Theme - index.template.php page show up.
Scroll down to the code field named: Beginning on line 59.. Your almost there...
Scroll that field to approx middle. You are looking for this little line of code:


--- Code: ---else
echo '<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';

--- End code ---

Change this code to:

--- Code: ---else
echo '<a href="http://www.MYSite.com"><img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" /></a>';
--- End code ---

..and don't forget that </a> at the end of that code. You are only adding the link. DON'T modify anything else. That's it, click save and look smart!  8)

TheCore

babjusi:
There is already a mod for this.

http://custom.simplemachines.org/mods/index.php?mod=1381

probeman:

--- Quote from: TheCore on August 15, 2009, 08:27:06 PM ---When the Forum is part of another Homepage, some of us like to incorporate a link back to the Homepage.
The solutions I found was rather complex and involved some mods. I like faster and more dirty
solutions, like this one, making that linked logo available anywhere in the Forum tree.
I assume you know as good as nothing, so I add some details you may skip if you know your
way around.

Most have the Forum installed as a subdomain of MYSite.com (like: forum.MYSite.com)
You'll figure that out I guess. It's normal to have the directory "Forum" (or what you call it) in
your public_html directory, or folder as the Mac'ers call it - where your Homepage content is.

First, upload your logo to the Theme images folder.
It's located something like this: MYSite.com/Forum//Themes/MYTheme/images/MYLogo.jpg

Next, login as forum Admin and add your logo to the Header.
You do this in: Configuration>Current Theme>Themes and Settings by adding
the path into the Logo image URL field like this:
forum.MYSite.com/Themes/MYTheme/images/MYLogo.jpg
If you see the logo in the head after "Save" you are close to genius. IQ rules. (luck too).

Now we add a link to that logo so users can jump from
forum.MYSite.com to your Homepage MYSite.com
with a click on the logo.

Do this:
On that same setup page: (Configuration>Current Theme>Themes and Settings),
at the top is a link saying: Modify the index template. (the main template).
Stare at it - and then Click on it. The Edit Theme - index.template.php page show up.
Scroll down to the code field named: Beginning on line 59.. Your almost there...
Scroll that field to approx middle. You are looking for this little line of code:


--- Code: ---else
echo '<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';

--- End code ---

Change this code to:

--- Code: ---else
echo '<a href="http://www.MYSite.com"><img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" /></a>';
--- End code ---

..and don't forget that </a> at the end of that code. You are only adding the link. DON'T modify anything else. That's it, click save and look smart!  8)

TheCore

--- End quote ---

This solution for adding a URL link to the forum logo is rather old and seems to require editing a file.  I have our own logo image loaded, but is there no other way to add a URL link to the logo image?

Kindred:
no. The only way to CHANGE the URL that the logo points to is to edit the code in index.template.php -- unless your theme allows a defined URL (some might, the default theme does not)


although, it looks like the mod posted just before your post may actually work in 2.0.x as well as 1.1.x (you would have to use the emulate version feature, to get the installation option)

GigaWatt:

--- Quote from: Kindred on June 05, 2018, 12:31:18 PM ---although, it looks like the mod posted just before your post may actually work in 2.0.x as well as 1.1.x (you would have to use the emulate version feature, to get the installation option)
--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version