Aug 17, 2019, 05:02 PM

News:

How many easter eggs have you found....


Fixed Logo

Started by lesmond, Apr 28, 2019, 10:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lesmond

Apr 28, 2019, 10:11 AM Last Edit: Apr 28, 2019, 03:33 PM by lesmond
I am trying to make it so the logo pre-loads when a theme is loaded, I have tried adding the code I found in smf2.0

this is the section I have added the logo image too 2.1RC2
<h1 class="forumtitle">
 <a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name_html_safe'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
 </h1>';

this is what it looks like after...
<h1 class="forumtitle">
 <a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="' . $settings['images_url'] . '/theme/logo1.png" alt="' . $context['forum_name_html_safe'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
 </h1>';

the logo loads but throws out the smflogo on the left

The only person who got all his work done by Friday was Robinson Crusoe

Bigguy

Does
forumtitle
have a float left in the css

Bigguy

You might have to play with the padding in that area.

lesmond

I think its this section that throws it out..
$settings['images_url']
I know I have done this before, but for the life of me I forgot (again :( )

The only person who got all his work done by Friday was Robinson Crusoe

Bigguy

Maybe removing one of the

<img src= would do the trick then...

SychO

I don't really understand what it is you're trying to do, why not just specify the logo's url in the theme's settings and then done ?

lurkalot

Quote from: SychO on Apr 28, 2019, 12:30 PMI don't really understand what it is you're trying to do, why not just specify the logo's url in the theme's settings and then done ?

I think Les is trying to create and package a theme with a default logo displayed. A default logo which can be then changed by the site admin by using the theme settings should that be desired..

I could be wrong though. ;)

lesmond

Apr 28, 2019, 01:40 PM #7 Last Edit: Apr 28, 2019, 01:43 PM by lesmond
Quote from: lurkalot on Apr 28, 2019, 12:46 PMI think Les is trying to create and package a theme with a default logo displayed. A default logo which can be then changed by the site admin by using the theme settings should that be desired..

Exactly right, thats what I want to do.

I have got a little closer, I managed to get the smflogo.svg to show now, but not the logo..

echo '
<div id="header">
<h1 class="forumtitle">
<a id="top" href="', $scripturl, '">',
empty($context['header_logo_url_html_safe']) ?
$context['forum_name_html_safe'] : '<img src="' .
$context['header_logo_url_html_safe'] . '/theme/logo.png" alt="' .
$context['forum_name_html_safe'] . '">', '</a>
</h1>';

The only person who got all his work done by Friday was Robinson Crusoe

SychO

<h1 class="forumtitle">
<a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="' . $settings['images_url'] . '/theme/logo1.png" alt="' . $context['forum_name_html_safe'] . '">' : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
</h1>';

lesmond

Thanks @SychO

Strange, thats what I had in my first post, second code block, wonder why It didnt work first time?

Quote from: lesmond on Apr 28, 2019, 10:11 AMthis is what it looks like after...
<h1 class="forumtitle">
 <a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="' . $settings['images_url'] . '/theme/logo1.png" alt="' . $context['forum_name_html_safe'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
 </h1>';

the logo loads but throws out the smflogo on the left

Ok so mark has solved  :rgton

The only person who got all his work done by Friday was Robinson Crusoe

SychO

This is the difference, php syntax, you didn't include what I highlighted in red

<h1 class="forumtitle">
 <a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="' . $settings['images_url'] . '/theme/logo1.png" alt="' . $context['forum_name_html_safe'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
 </h1>';


<h1 class="forumtitle">
 <a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? '<img src="' . $settings['images_url'] . '/theme/logo1.png" alt="' . $context['forum_name_html_safe'] . '">' : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
 </h1>';

lesmond

Oh right :emb  cool :vcool thanks again mate :rgton

The only person who got all his work done by Friday was Robinson Crusoe