Announcement

Collapse
No announcement yet.

How do i include a counter in the forumhome template?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do i include a counter in the forumhome template?

    I have signed up for an invisable counter from http://www.thecounter.com

    i need to put the code on the main forum page which i guess is forumhome?

    when i insert the code i get an error, parse in mainfile.php line 31

    how do i fix this? or does the code need to go elsewhere?


    please help!!


    regards,

    Jon Salman

  • #2
    it would be easier to insert it in the header or footer templates
    :: Always Back Up Forum Database + Attachments BEFORE upgrading !
    :: Nginx SPDY SSL - World Flags Demo [video results]
    :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

    Comment


    • #3
      but won't inserting it in the header make it register a page view every time a page on the forum is loaded?

      i am guessing that the header loads up on every page?

      Comment


      • #4
        well putting it on your frontpage only ain't accurate... cause not everyone comes in from the front page... my sites only 5 - 15% of visitors come in from the front door... i have around 600+ pages indexed in search engines for one site so they come from everywhere

        if you only want the frontpage then put it in forumhome template within a new table or existing table

        i don't know why it would give you an error unless you pasted it over some forumhome template code
        :: Always Back Up Forum Database + Attachments BEFORE upgrading !
        :: Nginx SPDY SSL - World Flags Demo [video results]
        :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

        Comment


        • #5
          Out of curiosity, what's the code you're trying to install?

          -jim
          "The dot-com bust has cleared out the carpetbaggers and left the Internet to those who really care about it"
          - Jon Ippolito, new-media curator, Guggenheim Museum

          Comment


          • #6
            this is the code:

            <!-- Start of TheCounter.com Code -->
            <SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
            s="na";c="na";j="na";f=""+escape(document.referrer)
            </SCRIPT>
            <SCRIPT TYPE="text/javascript" LANGUAGE="javascript1.2">
            s=screen.width;v=navigator.appName
            if (v != "Netscape") {c=screen.colorDepth}
            else {c=screen.pixelDepth}
            j=navigator.javaEnabled()
            </SCRIPT>
            <SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
            function pr(n) {document.write(n,"\n");}
            NS2Ch=0
            if (navigator.appName == "Netscape" &&
            navigator.appVersion.charAt(0) == "2") {NS2Ch=1}
            if (NS2Ch == 0) {
            r="&size="+s+"&colors="+c+"&referer="+f+"&java="+j+""
            pr("<A HREF=\"http://www.TheCounter.com\" TARGET=\"_top\"><IMG"+
            " BORDER=0 SRC=\"http://c2.thecounter.com/id=1404177"+r+"\"><\/A>")}
            </SCRIPT>
            <NOSCRIPT><A HREF="http://www.TheCounter.com" TARGET="_top"><IMG
            SRC="http://c2.thecounter.com/id=1404177" ALT="TC" BORDER=0></A>
            </NOSCRIPT>
            <!-- End of TheCounter.com Code -->



            Where do i put it!!

            Comment


            • #7
              Although putting the code in the footer would have it load for every page, that won't effect the unique hit count, so whats the difference. Just look at the unique hits, not the total hits. That should work fine I believe.

              Comment


              • #8
                Re: off topic

                Originally posted by the dnuk webmaster
                off topic:

                Hey JimF you have a Yellow smiles campiagn going?
                Yup, we dont like yellow smilies

                Look at my signature too

                Comment


                • #9
                  Putting the code in the footer still comes up with a parse error.

                  any reasons why?

                  is there somewhere special where i should be putting the code?

                  or would the easiest way be to create an index.html with the code in and also a frame for the forum pointing to index.php?

                  Comment


                  • #10
                    Have you tried?

                    Have you tried putting your counter code in its own Javascript file? Just remove the <SCRIPT> and </SCRIPT> tags and save it as counter.js

                    Then in your header or footer try adding:
                    <script language="Javascript" src="path/to/counter.js"><!-- Counter Script --></script>

                    I would try this and see if it works. This way there is no code that PHP might mistake for its own in the Templates.
                    Translations provided by Google.

                    Wayne Luke
                    The Rabid Badger - a vBulletin Cloud customization and demonstration site.
                    vBulletin 5 Documentation - Updated every Friday. Report issues here.
                    vBulletin 5 API - Full / Mobile
                    I am not currently available for vB Messenger Chats.

                    Comment


                    • #11
                      I would go with wluke's suggestion, because it's probably characters in the JavaScript causing the parse error... Putting the script in its own file will stop that.

                      It sounds to me like you only want it to count visits to the forum home page? If so, put the script tags wherever you want in the forumhome template, and not the header / footer.
                      We're Here Forums!
                      [email protected]

                      Comment


                      • #12
                        I think PHP also has a limitation preventing one to call CGI scripts from within a PHP script (security reasons, I believe). If TheCounter uses something CGI, I don't think it will let you use it...

                        - Philip

                        Comment

                        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                        Working...
                        X