TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 348
  • Total: 348

Mods for Ad rotation in panels/blocks

Started by shane is my name, February 25, 2010, 08:06:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shane is my name

Hello, just wondering if there were any such mods that would allow the tp blocks to rotate ads or images?



ZarPrime

Hi Shane,

No, nothing like this, at least not a standard block.  That's what Block Code Snippets are for and why users can design their own php and html blocks.  There are snippets of code in the Block Code Snippets Board that allow you to do both of these things.

ZarPrime

shane is my name

wow, ok I didn't even know that.  thanks. I'm off to check that out right now.  tinyportal has so many capabilities. love this.


Mick

Here's one i used to use.

Make a "script" block.   The script already has 3 banners in it so you get an idea where the urls, alt's and image location suppose to be.

Make sure you make your banners all the same size. 

The images will rotate when the page refreshes.

<SCRIPT LANGUAGE="javascript">
<!-- Copyright 2000 - Galichon Enterprises, Inc. rich@galichon.net http://www.galichon.net
// Permission granted to SimplytheBest.net to list the script in the DHTML scripts library
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function banner(img_source,url,alt,chance){
this.img_source = img_source;
this.url = url;
this.alt = alt;
this.chance = chance;
}
function display() {
with (this) document.write("<A HREF=" + url + "><IMG SRC='" + img_source + "' WIDTH=120 HEIGHT=600 BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.display = display;
banners = new Array();

banners[0] = new banner("http://www.chevyavalancheclub.com/gtgs/2010%20chevy%20avalanche%20meet%20120x600%201.png",
"http://www.chevyavalancheclub.com/index.php/board,281.0.html",
"2010 Chevy Avalanche National Meet",
10);
banners[1] = new banner("http://www.chevyavalancheclub.com/gtgs/2010%20chevy%20avalanche%20meet%20120x600%202.png",
"http://www.chevyavalancheclub.com/index.php/board,281.0.html",
"2010 Chevy Avalanche National Meet",
10);
banners[2] = new banner("http://www.chevyavalancheclub.com/Vendors/TPC-600-animation.gif",
"http://www.gatorbackcoatings.com/",
"Gatorback Coatings",
10);


sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
sum_of_all_chances += banners[i].chance;
}
function display_banner() {
chance_limit = 0;
randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
for (i = 0; i < banners.length; i++) {
chance_limit += banners[i].chance;
if (randomly_selected_chance <= chance_limit) {
document.write("<A HREF=" + banners[i].url + "><IMG SRC='" + banners[i].img_source + "' WIDTH=120 HEIGHT=600 BORDER=0 ALT='" + banners[i].alt + "'></A>");
return banners[i];
break;
}
}
}
//-->
</SCRIPT><SCRIPT LANGUAGE="javascript">
<!--
top_banner = display_banner();
//-->
</SCRIPT>

azGRUNT

BlueDevil,
Thanks for the code. I am a Uber-Newb so forgive me, but where specifically did you place this code? Just on the given page where the ad banner will be?

shane is my name

Hi bluedevil.   Im trying touse the code,  but maybe I dont have the same version of TP you have?   because I dont have an option for script block...
I did try using it in javascript box though but it didn't work.

Im using tp version 1 beta 4

I hope im not going to embarrass myself by missing the obvious, but i looked through all of the block options and didnt see any script block.

am i out of luck? 

IchBin

javascript is the option. Make sure you enter the code using the code mode of the editor. You need to press the <> button to enter code mode.

shane is my name

thats what i do, but as soon as i hit save, all the code dissappears... i do it over again and still, dissappears...

shane is my name

fyi - my blocks dont have a 'scriptbox'..  mine says 'html & javascript code'...

Ken.

Quote from: shane is my name on February 26, 2010, 05:25:19 AM
fyi - my blocks dont have a 'scriptbox'..  mine says 'html & javascript code'...

That's the correct style of block Shane.
The control that IchBinâ„¢ is talking about can be seen in the image below, you must click on it to change the editor over to the 'code' view... it should then take and save your code.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

This website is proudly hosted on Crocweb Cloud Website Hosting.