Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Dieter on May 30, 2006, 02:23:54 AM

Title: Ajax XML Ticker (txt file source) in a block (SMF and Tiny Portal)
Post by: Dieter on May 30, 2006, 02:23:54 AM
(This requires that you have the Tiny portal mod installed.)
I wanted a cool little ticker in one of my Tiny Portal (http://www.tinyportal.net) blocks on my site www.prowebdesign.no (the ticker used in the "Recent templates" block). As you can see, it fades in and out the most recent templates added here. This is not a default function in Tiny Portal so you have to do some small modifications in the source code. I thought maybe someone else could be interested in this too :). Ok, the first thing you need to do is to get the Ajax ticker, which you can download for free here:

http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm

Now you have to open your index.template.php and find </head>, (remember to backup) right above add:

      <script src="ajaxticker.js" type="text/javascript">
/***********************************************
* Ajax Ticker script (txt file source)- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
</script>

Save your file and upload it to your themes/yourtheme/index.template.php again

Now, open your style.css for your theme and add:

/*My ticker styler*/

#ajaxticker1{
width: 200px;
height: 100px;
border: 1px ridge black;
padding: 5px;
background-color: #FEEEB8;
}

#ajaxticker1 div{ /*IE6 bug fix when text is bold and fade effect (alpha filter) is enabled. Style inner DIV with same color as outer DIV*/
background-color: #FEEEB8;
}

.someclass{ //class to apply to your scroller(s) if desired
}

Upload it where it belongs (themes/yourtheme/style.css)


To display the ticker go to your admin panel and paste this script in a block (remember to use the script box):

<script type="text/javascript">

var xmlfile="tickercontent.txt" //path to ticker txt file on your server.

//ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot)
new ajax_ticker(xmlfile, "ajaxticker1", "someclass", 3500, "fade")
</script>

You should now have a nice little ticker on your site :)