MyBB Community Forums

Full Version: Adding counter to footer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello

I want to add my site counter to the footer.. It can be done by just adding <?php include("counter.php"); ?>

I tried to add the line to various locations in footer template... but it is not showing up and the counter is not working...

please help me
You can't use PHP in templates. In templates, only HTML may be used. What does counter.php contain??
Oh.. that is a disappointing news..

counter.php contains about 1000 lines of php code... So what can I do for adding the counter to the footer ? Any way to overcome the hurdle ?
Make a Counter and add the code in Footer template.
I have a counter script and it is running for the past 10 years.. but I need <?php include> function to work on that and I hope the other counters also require the same to be displayed in Mybb
Its fairly easy enough. If I've time, I'll write up for you. Please remind me via PM later on. Smile
Hi all.
So where I can add counter info to the footer template?
(2012-03-23, 08:44 AM)vovas Wrote: [ -> ]Hi all.
So where I can add counter info to the footer template?

http://yaldaram.com/showthread.php?tid=2809
(2012-03-23, 09:10 AM)Yaldaram Wrote: [ -> ]http://yaldaram.com/showthread.php?tid=2809

No, I mean how to add counter from the google analytics for example...? I have jscript code from my regional search site:
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter1111111 = new Ya.Metrika({id:1111111, enableAll: true, webvisor:true});
        } catch(e) {}
    });
    
    var n = d.getElementsByTagName("script")[0],
        s = d.createElement("script"),
        f = function () { n.parentNode.insertBefore(s, n); };
    s.type = "text/javascript";
    s.async = true;
    s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";

    if (w.opera == "[object Opera]") {
        d.addEventListener("DOMContentLoaded", f);
    } else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/1111111" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
When I put this code to the footer template, image doesn't load. So, my question is... where exactly insert this code?
That's completely different from what OP was asking, so its better next time to create a separate thread.

Anyway, in above code, the img src="" tag is looking wrong;
<img src="//mc.yandex.ru/watch/1111111"
The URL of the image path is wrong, it doesn't have http: beside double slashes. So make sure you're adding correct path.
Pages: 1 2