Advertisement:

Author Topic: Logo with link to (any) homepage  (Read 9917 times)

Offline TheCore

  • Newbie
  • *
  • Posts: 1
Logo with link to (any) homepage
« 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: [Select]
else
echo '<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';

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

..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

  • Guest
Re: Logo with link to (any) homepage
« Reply #1 on: August 22, 2009, 02:51:08 PM »

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #2 on: June 05, 2018, 10:55:50 AM »
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: [Select]
else
echo '<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';

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

..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

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?

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,508
  • Gender: Male
    • Kindred-999 on GitHub
Re: Logo with link to (any) homepage
« Reply #3 on: June 05, 2018, 12:31:18 PM »
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)
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline GigaWatt

  • The Smiley Guy
  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,606
  • Gender: Male
    • Macedonian electronics forum
Re: Logo with link to (any) homepage
« Reply #4 on: June 05, 2018, 12:38:35 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)

"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 17,734
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: Logo with link to (any) homepage
« Reply #5 on: June 05, 2018, 01:03:09 PM »
Yeah, seems it was removed from the modsite years ago - don't know why though.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #6 on: June 05, 2018, 09:15:31 PM »
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)

Forgive my ignorance, but if I do edit the index.template.php file for the logo URL, do I have to re-edit it every time after future updates?

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 17,734
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: Logo with link to (any) homepage
« Reply #7 on: June 05, 2018, 11:35:35 PM »
No, patches will not overwrite edits like that.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #8 on: June 06, 2018, 05:01:34 PM »
So I was going to attempt to edit the index.template.php file, but I think the line numbers have changed since the original post above.

That is, I looked for the line:

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

but can't locate it.  Can someone help?

Offline skb

  • Jr. Member
  • **
  • Posts: 293
    • Metabolically Challenged
Re: Logo with link to (any) homepage
« Reply #9 on: June 06, 2018, 07:09:49 PM »
You can do a Cntrl+F and Search for the text string. The line should be in the vicinity of the line number given.
Learning, every day.
Forum - The Diabetic Pub
Because every diabetic needs help
SMF 2.0.15 (default theme) / TP 1.42

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #10 on: June 06, 2018, 07:46:32 PM »
You can do a Cntrl+F and Search for the text string. The line should be in the vicinity of the line number given.

I can do that from the browser GUI?  Cool.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,508
  • Gender: Male
    • Kindred-999 on GitHub
Re: Logo with link to (any) homepage
« Reply #11 on: June 06, 2018, 09:03:11 PM »
Search for the header_logo_url
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #12 on: June 07, 2018, 02:06:11 PM »
So it's in the section labeled "Beginning on line 168", here:

            <a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>

But it says "header_logo_url_html_safe". Is this what gets edited?  Can you show me an example?

Sorry to bother you all, but I'm just a newbie.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,508
  • Gender: Male
    • Kindred-999 on GitHub
Re: Logo with link to (any) homepage
« Reply #13 on: June 07, 2018, 04:43:38 PM »
that URL is a setting that displays the IMAGE as defined in the theme setting in the admin
the edit you would be replacing is this


', $scripturl, '

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

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #14 on: June 07, 2018, 06:11:03 PM »
OK, so it would be:

<a href="http:\\myurl.com">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>

?

Also, by the way, it there an SMF posting setting that defaults to always "Return to this topic"?

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,508
  • Gender: Male
    • Kindred-999 on GitHub
Re: Logo with link to (any) homepage
« Reply #15 on: June 07, 2018, 08:00:23 PM »
yes, that would be the correct code.

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

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #16 on: June 07, 2018, 08:16:19 PM »
That does not work.  It sets the logo link to myurl.com/myurl.com

What should I do?

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #17 on: June 07, 2018, 08:17:59 PM »
OK, I figured it out (on my own!).  It needs to be set to:

<a href="http:\\">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,508
  • Gender: Male
    • Kindred-999 on GitHub
Re: Logo with link to (any) homepage
« Reply #18 on: June 07, 2018, 08:36:28 PM »
no, that can't be right. you need an actual url in there
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline probeman

  • Semi-Newbie
  • *
  • Posts: 54
Re: Logo with link to (any) homepage
« Reply #19 on: June 07, 2018, 09:00:43 PM »
You know more than me, but I'm just glad it's working!

Our forum is here:

http://probesoftware.com/smf/index.php

I edited the index.template.php file in the SMF Default Theme (2.0.14) right?  Not the Core Theme (2.0), right?