News:

Wondering if this will always be free?  See why free is better.

Main Menu

PNG Fix help

Started by picos, December 11, 2007, 12:30:40 PM

Previous topic - Next topic

picos

Hey folks, I'm new to smf and I was wondering how to get a pngfix to work with the forums? 

I know that png fixes work with IE6 as I have used them several times but getting it to work with SMF is proving to be a pain.

I have tried several but non are working.... perhaps i'm putting the code in the wrong place or what ever but it's not working.

I know ie6 is on the way out but I would like to learn how to get it working with smf.  If it works with phpbb then it should work with smf right? 

I have searched and the posts I read weren't all the detailed. 

If someone can be kind enough to help that would be super.

Ross

Alpha_Vector

Well, of all the people that use IE the majority has IE6, so I guess it is reasonable to attempt this.

First, what is the fix you are using?

SleePy

Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Alpha_Vector

In your SMF forum, where did you put the code?

SleePy

I simply uploaded the pngfix.js to my /Themes/default and then added to my index.template.php in the head section:

//If that person is using IE fix them
if ($context['browser']['is_ie7'])
echo '
<script defer type="text/javascript" src="', $settings['default_theme_url'], '/pngfix.js"></script>';


That code will work on any theme because I use $settings['default_theme_url'] to force it to use the default theme url, making it so you only need it in the default theme.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Alpha_Vector

#5
Ah, $context['browser']['is_ie7'] ?

I may be wrong, but doesn't that only gets printed if you are using IE7?

Edit: Why don't you try only 'is_ie' ?

picos

Thanks for the fast replies...  i have tried

http://homepage.ntlworld.com/bobosola/

and

http://www.twinhelix.com/css/iepngfix/

They both work but i just can't seem to get it working with smf.

I'm using the default template so where exactly on it would you put the code?  The default template has more than 1 head section...  thanks!

SleePy

yea it only gets printed with ie7..
You could change it to ie or use
if ($context['browser']['is_ie7'] || $context['browser']['is_ie6'])
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Alpha_Vector

Quote from: SleePy on December 11, 2007, 03:45:18 PM
yea it only gets printed with ie7..
You could change it to ie or use
if ($context['browser']['is_ie7'] || $context['browser']['is_ie6'])
But doesn't IE7 already renders PNG's?
Sure, it can be flawed sometimes but...

picos

all i want is a png fix for my IE 6 users... works great on FF and IE7...  which png fix works and where exactly is the code put? 

SleePy

It should, but I have had some IE7 users on my forum say it was still messed up.
You could remove the ie7 part if you wanted and just used the ie6. Its just a mater of changing the IF statement.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

picos

this is not working...

here is my first header area in the index.template.

// Show right to left and the character set for ease of translating.
   echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"';, $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
   <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
   <meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '
   <meta name="robots" content="noindex" />', '
   <meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
   <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
   <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
      var smf_theme_url = "', $settings['theme_url'], '";
      var smf_images_url = "', $settings['images_url'], '";
      var smf_scripturl = "', $scripturl, '";
      var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
      var smf_charset = "', $context['character_set'], '";
   // ]]></script>
   <title>', $context['page_title'], '</title>';
  // PNG fix
   
//If that person is using IE fix them

   if ($context['browser']['is_ie7'])
      echo '
   <script defer type="text/javascript" src="', $settings['theme_url'], '/pngfix.js"></script>';
   // The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
   echo '
   <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
   <link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';

picos

I tell a lie... it works for part of the pngs but the other pngs are not working....  why would only some pngs work and not others on the same page?

Alpha_Vector

Quote from: picos on December 11, 2007, 05:33:46 PM
I tell a lie... it works for part of the pngs but the other pngs are not working....  why would only some pngs work and not others on the same page?
Are the other png's part of a style sheet?

picos

yeah logo is in the index.template which is a png

the body of the forum is controlled by a style sheet.... style.css

i have tried

if ($context['browser']['is_ie'] && !$context ['browser']['is_ie7'])
   
      echo '
   <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" />';  default css
   else
      echo '
   <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/ie.css" />';  ie only css that has pngs with the backgrounds intact. 


this doesn't work at all.........  i dono what to do.  Tried the behavior in the css... that didn't work.  HELP!  I wouldn't usually bother but this is for a degree course and I need to make sure everything is covered across browsers including ie6. 

picos

Ok if I can't get a simple png fix working how about calling on a new style sheet?  I have tried that in several forms and that won't work either.

What i have done is, i installed smf then copied the default theme.  I downloaded all the files from the default theme and upped them all to a new theme folder and from there I created my own theme.  If i name the default folder defaultXXX for example my new theme which is in theme1 folder will load but it has lots of info missin so obviously the new theme is calling on files in this default folder that came with smf.  I tried naming all the files in my theme1 folder from theme_default to just theme where applicable and this still didn't make my theme appear how it should so I stuck the default folder name back to default and the theme1 worked how it should.  I dono if this extra info helps with why the pnf fix isn't working for the images in the style sheet or why i can't call another style sheet in when IE is found. 

Could someone please help me out with this............  either a png fix or at worse a call for another style sheet for IE6 only so i can have the png's with their backgrounds instead of transparent. 

THANKS!

Alpha_Vector

Hmmmm, try putting everything inside brackets?

if ($context['browser']['is_ie'] && !$context ['browser']['is_ie7'])
   {
      echo '
   <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" />';  }
   else {
      echo '
   <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/ie.css" />'; }


Also if you could post the html it produces it would help.

Bulakbol

I don't have IE7 to test it but this one work with Firefox.


// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
if ($context['browser']['is_ie'] && !$context['browser']['is_ie7'])
echo '<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />';
else
echo '<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/ie.css?fin11" />';


IE6 load the style.css while Firefox load the ie.css.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

picos

None of these are working...

http://www.err-clan.com/cod4/main/assets/forum/index.php

there's the URL of my forum. 

It works fine in FF and IE7 but IE6 is only showing the logo as transparent using the pngfix.js

The logo is included in the index.template.php file and does take the pngfix but the body of the forum which is in the css will not.

It just won't call the ie6only.css file i made.  The ie6only.css file is the same as the style.css i have apart from the images are not transparent. 

One of the transparent image can be seen here http://www.err-clan.com/cod4/main/assets/templates/err/images/cod4_04.png

The same images without the transparency is here
http://www.err-clan.com/cod4/main/assets/templates/err/images/ie6/cod4_04.png

both are reflected in the 2 different CSS files.


Bulakbol

So the pngfix is working for you. According to the instruction from where the png came from, you have to use the pngfix.js in all pages that use png's. It looks like you didn't use it in BoardIndex.template.php.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Advertisement: