News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Logo with link to (any) homepage

Started by TheCore, August 15, 2009, 08:27:06 PM

Previous topic - Next topic

GigaWatt

Quote from: probeman on June 07, 2018, 09:00:43 PM
I edited the index.template.php file in the SMF Default Theme (2.0.14) right?  Not the Core Theme (2.0), right?

Yes, that's the one that should be edited ;).

Quote from: Kindred on June 07, 2018, 08:36:28 PM
no, that can't be right. you need an actual url in there

Quote from: probeman on June 07, 2018, 08:17:59 PM
<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>

He's right, you need to have an actual URL in there, otherwise, it won't work. Have no idea how it works on your site with the "unfinished" URL.
"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?"..."

probeman

#21
Quote from: GigaWatt on June 08, 2018, 09:19:55 AM
Quote from: probeman on June 07, 2018, 09:00:43 PM
I edited the index.template.php file in the SMF Default Theme (2.0.14) right?  Not the Core Theme (2.0), right?

Yes, that's the one that should be edited ;).

Why the wink emoticon?   Are you saying I edited the wrong file?   I don't enjoy this being non-standard, I prefer to get it right.

Let me set it back to the original text and walk through the steps just confirm.  I went to Themes | Themes and Layout Settings  | Modify Themes menu, Then under Modify Themes | SMF Default Theme Curve (2.0.14) I clicked the "Browse the templates and files in this theme" link.

Then I clicked on index.template.php and edited these lines back to the original text"

Quotefunction template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

   echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
   <div id="header"><div class="frame">
      <div id="top_section">
         <h1 class="forumtitle">
            <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>
         </h1>';

   // the upshrink image, right-floated
   echo '

Then I clicked Save Changes and with this original text our forum logo link points to our forum as before.  So then I replaced the above red text to this text in red:

Quotefunction template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

   echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
   <div id="header"><div class="frame">
      <div id="top_section">
         <h1 class="forumtitle">
            <a href="http://probesoftware.com">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
         </h1>';

   // the upshrink image, right-floated
   echo '

Then clicked Save Changes.  Then when I put my mouse over our logo... wait a minute, that's weird.  It works now.

Hmmm, I'm pretty dyslexic so I have to wonder if it's because I had put http:\\probesoftware.com instead of http://probesoftware.com

Weird.  I'm really sorry for all the trouble.  It's working now with the full URL so I'm happy.  Thanks and sorry again.

Kindred

glad its working.

incidentally.... although you CAN use the online/admin editor like that - best practice is to use your hosting file manager or FTP to edit php files
(and making bad edits directly could make your site inaccessible to correct the edit)

also, remember, with any updates, you may need to clear the cache after the change is applied...  both server side and browser side (ctrl-f5 on the page)
Сл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."

probeman

Quote from: Kindred on June 08, 2018, 01:13:51 PM
incidentally.... although you CAN use the online/admin editor like that - best practice is to use your hosting file manager or FTP to edit php files
(and making bad edits directly could make your site inaccessible to correct the edit)

I was wondering about that, but was also scared of ftp'ing the file back with the wrong file permissions...

Thanks for all your help.

GigaWatt

Quote from: probeman on June 08, 2018, 11:31:29 AM
Why the wink emoticon?   Are you saying I edited the wrong file?   I don't enjoy this being non-standard, I prefer to get it right.

It's a smiley... as far as I know ???... emoticons are symbols, smileys are formed using a combination of ASCII characters.

Beside the point... I used the wink smiley to say "you're right, that's the file that should be edited". I rarely use sarcasm in posts. If I wanted to be sarcastic, I would have written something like "Yeah, that's the one ::)".

Quote from: probeman on June 08, 2018, 11:31:29 AM
Let me set it back to the original text and walk through the steps just confirm.  I went to Themes | Themes and Layout Settings  | Modify Themes menu, Then under Modify Themes | SMF Default Theme Curve (2.0.14) I clicked the "Browse the templates and files in this theme" link.

Correct ;). (Not being sarcastic.)

As for the rest of the post (not to quote the whole thing), yes, you did the right corrections ;). In your previous post, you wrote that you only added http://, not http://probesoftware.com... in which case it wouldn't have worked. I think that's what Kindred was trying to say, it can't work with an "unfinished" URL, you have to have the full URL in that field, the way you explained it in you next post ;) (again, not being sarcastic).
"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?"..."

brenth

I found this thread that described what I was trying to do with my new installation of SMF, however I seem to be having trouble making it work. I uploaded my logo image and that is displayed. I then found the header url line in the index template and edited it.

I changed this line

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

to this

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

But when I attempt to save it I get this error.

Template Parse Error!
There was a problem loading the /Themes/default/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
syntax error, unexpected 'header_logo_url_html_safe' (T_STRING), expecting ',' or ';'

I have been careful not to change any other part of the template, so I do not know how to correct this error and was wondering if anyone might have a suggestion.

Shambles

Please download and attach that file to your next post and we'll have a look at it.

Kindred

we need to see the ACTUAL line of text, with the actual url... I suspect that you changed something that should not have been changed....
Сл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."

brenth

The above is the actual line of text, and the actual URL was hxxp:arkansaschurchsecurity.org/ [nonactive]. I too thought I must have altered something though, as I mentioned I was careful not to change anything but what I indicated above.

In any case, after I could not get it to work I restored the original index.template file so that things would work again. Today I had the chance to go reinstate the change so I could upload the altered file here. However, this time it worked properly with no error. I am not able to determine what might have been different this time, but apparently there was some difference.

This is my first time to install and use the Simple Machines Forum and I appreciate your willingness to help me with my question.


Arantor

It would be helpful if you showed us the *exact* code you had, not 'here's what I did and here's the other part of it' because it sounds like when you edited it the first time, it wasn't edited correctly, and seeing exactly what you did matters for getting it right, though I guess it was right the second time.

Advertisement: