Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: ftab4me - joulukuu 26, 2013, 05:57:14 IP

Otsikko: Trying to get some code to work "feedjit"
Kirjoitti: ftab4me - joulukuu 26, 2013, 05:57:14 IP
Hi all,

I am trying to add some special code in order to get stats on my visitors, the code is the following:


echo '
<div>
<script type="text/javascript" src="http://feedjit.com/serve/?vv=1436&tft=3&dd=0&wid=4d4d7de8a1544391&pid=0&proid=0&
bc=FFFFFF&tc=000000&brd1=012B6B&lnk=135D9E&hc=FFFFFF&hfc=2853A8&btn=C99700&ww=200&went=10"></script>
<noscript><a href="http://feedjit.com/">Live Traffic Stats</a></noscript>
</div> '


I added this code to my Themes\default\index.template.php file. It displays on my main page without error except it is at the top of the page above the main menu on the left side. It also increased the font size of the page? What I would like to do is have it display on the right side of the menu.  Does anyone have a snip it of code that I can add to accomplish this as I  not a coder.

Thanks,

Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: shadow82x - joulukuu 26, 2013, 08:01:00 IP
It's hard to say without seeing the whole picture here, you should attach that index.template.php here. ;) But the first thing I noticed with the bit of code you posted is there is no ";" after the apostrophe in the closing </div> . Normally that would throw a syntax error though. A second guess is you might want to check the nesting of the divs before and after that code. Just to make sure there is an opening and closing div for each statement.
Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: ftab4me - joulukuu 26, 2013, 11:50:10 IP
mcblaber,

Thank you for the reply. I had placed this code at the end of the file just above the ?> and it ran without error except for the data I want displayed was at the top of the menu tree and the fonts increased in size. I than moved the code to several different locations in the code in the file and had to add the ; to stop the errors I than started to receive.

I am not a coder and am completely lost. I want the data from feedjit to show on the right side of the menu "please see attached image1".Image2 is what it looks like currently. I have attached the index.template.php file as requested. The feedjit code is currently starts at line 323. Any help you or anyone can give me is greatly appreciated.

Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: Chen Zhen - joulukuu 26, 2013, 11:58:43 IP
ftab4me,

  Imo installing a portal would allow you to add things like that without having to edit any files. All you would need to do in this case is create a right side html block that contains your code (just the html) and set it to display where you wish. I will suggest Simple Portal.
Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: ftab4me - joulukuu 27, 2013, 12:18:53 AP
Underdog,

Thank you. I will take a look at simple portal.
Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: Chen Zhen - joulukuu 27, 2013, 12:30:13 AP
ftab4me,

  When you are creating/editing the HTML block, opt no title & no body (located at the bottom). There will be an input box to the bottom right that reads Custom Body Style, enter the following css code into it:

overflow:hidden;width:100%;


You will also need to adjust the setting that reads Show Block On to have it display where you want on your forum.

For the actual block code just use the html from what you posted:

<div>
<script type="text/javascript" src="http://feedjit.com/serve/?vv=1436&tft=3&dd=0&wid=4d4d7de8a1544391&pid=0&proid=0&
bc=FFFFFF&tc=000000&brd1=012B6B&lnk=135D9E&hc=FFFFFF&hfc=2853A8&btn=C99700&ww=200&went=10"></script>
<noscript><a href="http://feedjit.com/">Live Traffic Stats</a></noscript>
</div>


  That will allow it to display as you wish.
Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: shadow82x - joulukuu 27, 2013, 12:42:18 AP
Agreed, something like SimplePortal/TinyPortal/DreamPortal would make your life a lot easier for formatting a widget like that. ;)
Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: ftab4me - joulukuu 27, 2013, 02:29:11 AP
We'll Simple Portal is a no go as it does not play nice with one or more of the mods I have installed. I will look at some of the other portals and see if I can get one of them to work.

Thanks again and I will let you know.
Otsikko: Re: Trying to get some code to work "feedjit"
Kirjoitti: ftab4me - joulukuu 29, 2013, 12:31:43 AP
-underdog-,

As you know I finally got Simple Portal to work on my test system. I have now installed it on my production system and Feedjit is installed and working as I wanted. Thank you for suggesting Simple Portal as a solution. It is a really great mod.

I am marking this topic as solved.