Forums

Multiple javascript call and stylesheet error

vecchia 13 Jun, 2009
Hi,
i have a very big problem with the latest version of chronocomments... In my site when i run it in front-page i have a style problem with the template: it is aligned in the left of the screen and i have multiple call of the javascript code... please help me😢
vecchia 13 Jun, 2009
sorry for my english because I don't speak it very well and sorry for my double post but i have news about the problems... I searched in the forum and i found a new version of the plugin, i run it and now there aren't multiple javascript call's😀 but there is the stylesheet problem😢 i try to search the bug and it's in this line in the plugin's file:

$document->addCustomTag('<!--[if !IE]> <--><link href="'.JURI::Base().'components/com_chronocomments/style.css" rel="stylesheet" type="text/css" /><!--> <![endif]-->');

if i replace the line with this:

document->addCustomTag('<!--[if !IE]> <!--><link href="'.JURI::Base().'components/com_chronocomments/style.css" rel="stylesheet" type="text/css" /> <![endif]-->');

it works but i have an alignment problem of the bbcode panel... it is on the right😲
vecchia 14 Jun, 2009
i solved but i have modified the file:

ChronoComments.php (plugin)

<span class="syntaxdefault"></span><span class="syntaxcomment">/* ie browser (yoo-login) */<br /></span><span class="syntaxdefault">$is_ie7 </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> strpos</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">strtolower</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$_SERVER</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'HTTP_USER_AGENT'</span><span class="syntaxkeyword">]),</span><span class="syntaxdefault"> </span><span class="syntaxstring">'msie 7'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">!==</span><span class="syntaxdefault"> false</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">$is_ie6 </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">!</span><span class="syntaxdefault">$is_ie7 </span><span class="syntaxkeyword">&&</span><span class="syntaxdefault"> strpos</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">strtolower</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$_SERVER</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'HTTP_USER_AGENT'</span><span class="syntaxkeyword">]),</span><span class="syntaxdefault"> </span><span class="syntaxstring">'msie 6'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">!==</span><span class="syntaxdefault"> false</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxdefault">if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$is_ie6</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">  $document</span><span class="syntaxkeyword">-></span><span class="syntaxdefault">addCustomTag</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'<link href="'</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">JURI</span><span class="syntaxkeyword">::</span><span class="syntaxdefault">Base</span><span class="syntaxkeyword">().</span><span class="syntaxstring">'components/com_chronocomments/style-ie6.css" rel="stylesheet" type="text/css" />'</span><span class="syntaxkeyword">);<br />}<br /></span><span class="syntaxdefault">else </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">  $document</span><span class="syntaxkeyword">-></span><span class="syntaxdefault">addCustomTag</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'<link href="'</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">JURI</span><span class="syntaxkeyword">::</span><span class="syntaxdefault">Base</span><span class="syntaxkeyword">().</span><span class="syntaxstring">'components/com_chronocomments/style.css" rel="stylesheet" type="text/css" />'</span><span class="syntaxkeyword">);<br />}</span><span class="syntaxdefault"> </span>


style.css

#comments-container .left { float:left!important;}


now it works on ie7 and fierfox😀 i hope that someone see this code and add the fix in the next chronocomments release🙄
GreyHead 14 Jun, 2009
Hi vecchia,

Joomla has a browser sniffer built in and this code will do much the same as yours
$doc =& JFactory::getDocument();
$cf_uri       = JURI::Base().'components/com_chronocontact/';
jimport('joomla.environment.browser');
 $browser = JBrowser::getInstance();
 $name = $browser->getBrowser();
$suffix = '';
if ( $name == 'msie') {
    switch ( $browser->getVersion() ) {
        case '6.0':
            $suffix = '-ie6';
            break;
        case '7.0':
            $suffix = '-ie7';
            break;
        default:
            $suffix = '';
            break;
    }
}
$doc->addStyleSheet( $cf_uri."themes/default/css/style1$suffix.css");

You can adjust the 'switch' to match up the IE versions with the style files you want to use.

Bob
vecchia 14 Jun, 2009
yes but chronocomment use the same file for ie7 and firefox so my code is easier that yours😀 i hope you will fix the component soon :wink:
vecchia 24 Jun, 2009
a member of the forum contacts me for e-mail, i think that this is an important information for all so i post the solution there:

the file that you must edit is in:

rar file -> admin folder -> plugin folder -> ChronoComments.php

srilu 21 Jul, 2009
Hi,

We are using chrono comments 1.2. we are also facing the same problem. we tried with coding changes whatever suggested in this thread. it doesn't work for us. Could you pl help us in solving this problem.

Thanks,
Srilu
vecchia 21 Jul, 2009
Which problem do you have? My hack only fix the loading of differents css...
This topic is locked and no more replies can be posted.