How can i put this script on index.template.php?

Started by aludidos, January 21, 2015, 07:37:19 PM

Previous topic - Next topic

aludidos

IS a chat script


<!-- HelpOnClick -->
<script type='text/javascript'>(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = '//traffic7.helponclick.com/assist?lang=es&ava=1&a=54c0315cd7e0432bb3e92f1ea2d1033f&mode=widget&widget=r';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();</script>
<div style='display:none'><a href='http://www.helponclick.com'>Live Chat Software</a></div>
<!-- /HelpOnClick -->

kat



Depends on where, on the page, you want it to appear.

Do you really want it on every page?

If you only want it on one page, it works fine as a custom HTML block, in Simple Portal, if that helps?

TehCraw

Easy enough. Find this bit, typically around line 355.


function template_html_below()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

echo '
</body></html>';
}


And change it to this.


function template_html_below()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

echo '
<!-- HelpOnClick -->
<script type="text/javascript">(function() {
var po = document.createElement(\'script\'); po.type = \'text/javascript\';
po.async = true;
po.src = \'//traffic7.helponclick.com/assist?lang=es&ava=1&a=54c0315cd7e0432bb3e92f1ea2d1033f&mode=widget&widget=r\';
var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
})();</script>
<div style="display:none"><a href="http://www.helponclick.com">Live Chat Software</a></div>
<!-- /HelpOnClick -->';

echo '
</body></html>';
}


This assumes you're using the default theme. If not, there's a better way to add custom code to every theme without editing the index file of each one.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

Advertisement: