inserting a script in the gk_boutique template

GK User
Wed Jan 11, 2012 5:40 pm
Hello guys!

Please help me insert the follwing script in my template (gk_boutique). I tried to do this several times using the custom module (on position bottom 1) but it doesn't work. Form some reason the code I insert in the html editor it is alterd.

The script I want to insert looks like this:

<!--/Start async trafic.ro/-->
<script type="text/javascript" id="trfc_trafic_script">
//<![CDATA[
t_rid = 'jurnaldefrumusete-ro';
(function(){ t_js_dw_time=new Date().getTime();
t_js_load_src=((document.location.protocol == 'http:')?'http://storage.':'https://secure.')+'trafic.ro/js/trafic.js?tk='+(Math.pow(10,16)*Math.random())+'&t_rid='+t_rid;
if (document.createElement && document.getElementsByTagName && document.insertBefore) {
t_as_js_en=true;var sn = document.createElement('script');sn.type = 'text/javascript';sn.async = true; sn.src = t_js_load_src;
var psn = document.getElementsByTagName('script')[0];psn.parentNode.insertBefore(sn, psn); } else {
document.write(unescape('%3Cscri' + 'pt type="text/javascript" '+'src="'+t_js_load_src+';"%3E%3C/sc' + 'ript%3E')); }})();
//]]>
</script>
<noscript><p><a href="http://www.trafic.ro/statistici/jurnaldefrumusete.ro"><img alt="jurnaldefrumusete.ro" src="http://log.trafic.ro/cgi-bin/pl.dll?rid=jurnaldefrumusete-ro" /></a> <a href="http://www.trafic.ro/">Web analytics</a></p></noscript>
<!--/End async trafic.ro/-->

What's the path to the file I should edit if I want to insert that script manually?

thank you very much!
User avatar
Fresh Boarder

GK User
Wed Jan 11, 2012 6:42 pm
p.s. I have the same problem when i try to insert Google AdSense scripts.
User avatar
Fresh Boarder

GK User
Wed Jan 11, 2012 10:23 pm
This script should be probably added in head section where all template js files are loaded, please open file template/layouts/blocks/head.php and try to paste script right above <head> tag.
User avatar
Platinum Boarder

GK User
Thu Jan 12, 2012 6:16 pm
bkrztuk wrote:This script should be probably added in head section where all template js files are loaded, please open file template/layouts/blocks/head.php and try to paste script right above <head> tag.


thank you for your answer bkrztuk!

still not working. this is the code in my template (/templates/gk_boutique/layouts/blocks/footer.php):

<?php

// This is the code which will be placed in the head section

// No direct access.
defined('_JEXEC') or die;

$favicon_image = $this->getParam('favicon_image', '');

if($favicon_image == '') {
$favicon_image = $this->URLtemplate() . '/images/favicon.ico';
} else {
$favicon_image = $this->URLbase() . $favicon_image;
}

$this->API->addFavicon($favicon_image);

?>

<?php

if($this->browser->get('browser') != 'ie6') {
// check the color version
$template_style = '';
$template_pattern = '';

if($this->getParam("stylearea", 1)) {
$template_style = (isset($_COOKIE['gk_boutique_16_style']) ? $_COOKIE['gk_boutique_16_style'] : $this->getParam("template_color", 1));
} else {
$template_style = $this->getParam("template_color", 1);
}
// load the CSS files
if($this->getParam('reset_css', '') != '') {
$this->addCSS($this->URLtemplate() . '/css/reset/'.$this->getParam('reset_css', '').'.css');
}

$this->addCSS($this->URLtemplate() . '/css/layout.css');
$this->addCSS($this->URLtemplate() . '/css/joomla.css');
$this->addCSS($this->URLtemplate() . '/css/template.css');
$this->addCSS($this->URLtemplate() . '/css/menu.css');
$this->addCSS($this->URLtemplate() . '/css/gk.stuff.css');
$this->addCSS($this->URLtemplate() . '/css/k2.css');
$this->addCSS($this->URLtemplate() . '/css/redshop.css');

if($this->getParam('typography', '1') == '1') {
$this->addCSS($this->URLtemplate() . '/css/typography.style'.$template_style.'.css');
if($this->getParam('typo_iconset1', '1') == '1') $this->addCSS($this->URLtemplate() . '/css/typography.iconset.1.css');
}

$this->addCSS($this->URLtemplate() . '/css/style'.$template_style.'.css');

if($this->getParam("css_override", '0')) {
$this->addCSS($this->URLtemplate() . '/css/override.css');
}

$this->useCache($this->getParam('css_compression', '0'), $this->getParam('css_cache', '0'));
// include fonts
$font_iter = 1;

while($this->getParam('font_name_group'.$font_iter, 'gkFontNull') !== 'gkFontNull') {
$font_data = explode(';', $this->getParam('font_name_group'.$font_iter, ''));
if(isset($font_data) && count($font_data) >= 2) {
$font_type = $font_data[0];
$font_name = $font_data[1];

if($font_type == 'standard') {
$this->addCSSRule($this->getParam('font_rules_group'.$font_iter, '') . ' { font-family: ' . $font_name . '; }'."\n");
} elseif($font_type == 'google') {
if($font_name != 'own') {
echo '<link href="http://fonts.googleapis.com/css?family='.$font_name.'" rel="stylesheet" type="text/css" />';

$gfont = $font_name;

if(stripos($gfont, ':') !== FALSE) {
$gfont_cut = stripos($gfont, ':');
$gfont = substr($gfont, 0, $gfont_cut);
}

$this->addCSSRule($this->getParam('font_rules_group'.$font_iter, '') . ' { font-family: \''.str_replace('+', ' ', $gfont). '\', Arial, sans-serif; }'."\n");
} else {
$font_link = $font_data[2];
$font_family = $font_data[3];

echo '<link href="'.$font_link.'" rel="stylesheet" type="text/css" />';

$this->addCSSRule($this->getParam('font_rules_group'.$font_iter, '') . ' { font-family: \''.$font_family.'\', Arial, sans-serif; }'."\n");
}
} elseif($font_type == 'squirrel') {
echo '<link href="'. $this->URLtemplate() . '/fonts/' . $font_name . '/stylesheet.css" rel="stylesheet" type="text/css" />';
$this->addCSSRule($this->getParam('font_rules_group'.$font_iter, '') . ' { font-family: ' . $font_name . ', Arial, sans-serif; }'."\n");
}
}

$font_iter++;
}
// include JavaScript
$this->addJS($this->URLtemplate() . '/js/gk.scripts.js');

if($this->browser->get('browser') == 'ie7') {
$this->addJS($this->URLtemplate() . '/js/ie7.equal.columns.js');
}

if($this->getParam('selectivizr', '0') == 1 && ($this->browser->get('browser') == 'ie7' || $this->browser->get('browser') == 'ie8')) {
$this->addJS($this->URLtemplate() . '/js/selectivizr.js');
}

if($this->getParam('menu_type', 'gk_menu') == 'gk_menu') {
$this->addJSFragment(' $GKMenu = { height:'.($this->getParam('menu_height','0') == 1 ? 'true' : 'false') .', width:'.($this->getParam('menu_width','0') == 1 ? 'true' : 'false') .', duration: '.($this->getParam('menu_duration', '500')).' };');
}

$this->addJSFragment( '$GK_TMPL_URL = "' . $this->URLtemplate() . '";' );

?>

<!--[if IE 8.0]><link rel="stylesheet" href="<?php echo $this->URLtemplate(); ?>/css/ie8.css" type="text/css" /><![endif]-->
<!--[if IE 7.0]><link rel="stylesheet" href="<?php echo $this->URLtemplate(); ?>/css/ie7.css" type="text/css" /><![endif]-->

<?php

} else {

// IE6 code
$this->addCSS( $this->URLtemplate(). '/css/ie6.css');

}

they say to insert that script before website's </body> But I don't know where is the templates index.php file in order to add this script an if it can be written.

please help.
thank you!
User avatar
Fresh Boarder

GK User
Thu Jan 12, 2012 7:09 pm
<body> tag you can surely find in template/layouts/default.php but script usually are loaded in <head> section so you can try to paste this code in the end of head.php file (not between <?php ?> tags)
User avatar
Platinum Boarder

GK User
Fri Jan 13, 2012 9:00 am
bkrztuk wrote:<body> tag you can surely find in template/layouts/default.php but script usually are loaded in <head> section so you can try to paste this code in the end of head.php file (not between <?php ?> tags)


Hi,
I inserted the script like you said, in the head.php and I got this:
Parse error: syntax error, unexpected '<' in /home/afuacumr/public_html/jurnaldefrumusete.ro/templates/gk_boutique/layouts/blocks/head.php on line 127

I will try to isert it in the default.phph file and see what happens.

thank you!
User avatar
Fresh Boarder


cron