Conditional comment for IE

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
mustardstache
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Feb 04, 2008 1:20 am

Conditional comment for IE

Post by mustardstache » Fri Mar 07, 2008 3:26 pm

I'm trying to use conditional for comment IE. I would like for IE to get a static image in the top div and for all other browsers to load the javascript. Any ideas what i'm doing wrong here? It's working in safari but nothing else..

Code: Select all

<body>
<!--Beginn Tabelle Wrapper -->
<table cellpadding="0" cellspacing="0" height="100%" border="0" align="center" id="wrapper">
  <tr>
    <td  align="left" valign="top" class="col_left">
	<div id="div_top">
	<!--[if! ie]><img src="templates/jp_12_2007_dirtystyle/images/header_2.jpg" align="center" width="560" height="140"><![endif]> 
	<!--[if! ie]><!-->
	<script type="text/javascript">
	//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)
new fadeshow(fadeimages, 560, 140, 0, 7000, 0)
 	</script>
 	<![endif]-->
</div>
      <div id="div_main"><?php mosMainBody(); ?></div>
	  <div id="div_footer"><?php if (mosCountModules('banner')>0) mosLoadModules('banner',0); ?></div>
	  

    </td>
    <td  align="left" valign="top" class="col_right">
	 <div id="div_right"><?php if (mosCountModules('right')>0) mosLoadModules('right',0); ?></div>

	
	</td>
  </tr>
</table>
</body>
Last edited by mustardstache on Tue Mar 11, 2008 3:37 pm, edited 1 time in total.

newseed
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 173
Joined: Tue Feb 06, 2007 3:40 pm

Re: Conditional comment for IE

Post by newseed » Fri Mar 07, 2008 3:31 pm

<!--[if! ie]><img src="templates/jp_12_2007_dirtystyle/images/header_2.jpg" align="center" width="560" height="140"><![endif]-->

The end statement is missing the two dash lines.

mustardstache
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Feb 04, 2008 1:20 am

Re: Conditional comment for IE

Post by mustardstache » Fri Mar 07, 2008 4:38 pm

Thanks, That helped a lot. The Javascript now works in every other browser and Explorer is ignoring the Javascript but the static image is not being displayed in explorer. Could there be anything else wrong?

newseed
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 173
Joined: Tue Feb 06, 2007 3:40 pm

Re: Conditional comment for IE

Post by newseed » Fri Mar 07, 2008 5:19 pm

mustardstache wrote:Thanks, That helped a lot. The Javascript now works in every other browser and Explorer is ignoring the Javascript but the static image is not being displayed in explorer. Could there be anything else wrong?
Post the code again because when I looked at your old code, I noticed you had those dashes located after the end statment. See the next [if IE] statement you may see what I am talking about.

mustardstache
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Feb 04, 2008 1:20 am

Re: Conditional comment for IE

Post by mustardstache » Fri Mar 07, 2008 6:30 pm

this is what I have now

Code: Select all

?>
<!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">
<link href="<?php echo $mosConfig_live_site;?>/templates/<?php echo $mainframe->getTemplate(); ?>/css/layout.css" rel="stylesheet"  type="text/css" />
<link href="<?php echo $mosConfig_live_site;?>/templates/<?php echo $mainframe->getTemplate(); ?>/css/template_css.css" rel="stylesheet"  type="text/css" />
<script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/templates/<?php echo $mainframe->getTemplate(); ?>/images/slideshow.js"></script>

<head>
<?php mosShowHead(); ?>
<?php if ( $my->id ) { initEditor(); } ?>



</head>
<body>
<!--Beginn Tabelle Wrapper -->
<table cellpadding="0" cellspacing="0" height="100%" border="0" align="center" id="wrapper">
  <tr>
    <td  align="left" valign="top" class="col_left">
	<div id="div_top">
	<!--[if! ie]>
	<img src="images/header_2.jpg" align="center" width="560" height="140">
	<![endif]--> 
	<!--[if! ie]><!-->
	<script type="text/javascript">
	//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)
new fadeshow(fadeimages, 560, 140, 0, 7000, 0)
 	</script>
 	<![endif]-->
	</div>
      <div id="div_main"><?php mosMainBody(); ?></div>
	  <div id="div_footer"><?php if (mosCountModules('banner')>0) mosLoadModules('banner',0); ?></div>
	  

    </td>
    <td  align="left" valign="top" class="col_right">
	 <div id="div_right"><?php if (mosCountModules('right')>0) mosLoadModules('right',0); ?></div>

	
	</td>
  </tr>
</table>
</body>
</html>

newseed
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 173
Joined: Tue Feb 06, 2007 3:40 pm

Re: Conditional comment for IE

Post by newseed » Fri Mar 07, 2008 6:54 pm

Look for this line:

<!--[if! ie]><!-->

and remove the <!--> from the end of it.

mustardstache
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Feb 04, 2008 1:20 am

Re: Conditional comment for IE

Post by mustardstache » Fri Mar 07, 2008 7:08 pm

I don't want IE to see that javascript. I read in a different article that the <!--> after will make ie not view that line. That part of the code is working. All other browsers are using the javascript and IE is not. The problem I am having is that the conditional comment to embed a static image is not working.
this is the problem code;

Code: Select all

<!--[if! ie]><img src="templates/jp_12_2007_dirtystyle/images/header_2.jpg" align="center" width="560" height="140"><![endif]> 

newseed
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 173
Joined: Tue Feb 06, 2007 3:40 pm

Re: Conditional comment for IE

Post by newseed » Fri Mar 07, 2008 7:38 pm

<!--[if! ie]>
<img src="images/header_2.jpg" align="center" width="560" height="140">
<![endif]-->
<!--[if! ie]><!-->
<script type="text/javascript">
//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)
new fadeshow(fadeimages, 560, 140, 0, 7000, 0)
</script>
<![endif]-->
The above in bold don't belong.

mustardstache
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Feb 04, 2008 1:20 am

Re: Conditional comment for IE

Post by mustardstache » Fri Mar 07, 2008 8:49 pm

That did not help. The script is now not in any browser. Is there a different way to hide the script from IE besides the way I was doing it with the <!--> that you told me to remove?

newseed
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 173
Joined: Tue Feb 06, 2007 3:40 pm

Re: Conditional comment for IE

Post by newseed » Fri Mar 07, 2008 10:00 pm

mustardstache wrote:That did not help. The script is now not in any browser. Is there a different way to hide the script from IE besides the way I was doing it with the <!--> that you told me to remove?
My apologies. I see what you are trying to do but I can't think right off hand if this method works or not.

Do you have a url for us to look at that has this problem?

EDIT: Just a thought but have you tried switching the image code and script code to read the script first and then the image?

mustardstache
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Feb 04, 2008 1:20 am

Re: Conditional comment for IE

Post by mustardstache » Fri Mar 07, 2008 11:51 pm

Success! switching them around made it work. Thanks so much for your help!! :D
see for yourself; http://www.phillyrollerderby.com

Hund
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Jul 07, 2009 3:06 pm
Contact:

Re: Conditional comment for IE

Post by Hund » Tue Jul 07, 2009 3:53 pm

Just what I was looking for! Thank you!!
My dog has it's own website at: http://www.hundefeber.no

pensjon
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Jul 07, 2009 3:56 pm
Contact:

Re: Conditional comment for IE

Post by pensjon » Tue Jul 07, 2009 4:01 pm

Nice sharing! That helped a lot! I'm experiencing the same problem with the Pensjon section on this website - but the problems seems to have reduced by almost 90 % :-)

Strangely the error is not showing on the other sections and therefore I was a bit confused..
Norwegian senior magazine with more than 400.000 readers http://viover60.no is now using Joomla!

kreswach
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Apr 14, 2011 11:11 am
Location: Serbia
Contact:

Re: Conditional comment for IE

Post by kreswach » Sat Apr 23, 2011 6:01 pm

Finally !

Thank good I found this post :)

Thanks neewseed !

Mr Clean
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Jul 06, 2011 12:28 am

Re: Conditional comment for IE

Post by Mr Clean » Wed Jul 06, 2011 1:34 am

Thanks newseed! This worked perfectly!


Locked

Return to “Templates for Joomla! 1.5”