Hello, just wondering if there were any such mods that would allow the tp blocks to rotate ads or images?
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
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.
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>
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?
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?
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.
thats what i do, but as soon as i hit save, all the code dissappears... i do it over again and still, dissappears...
fyi - my blocks dont have a 'scriptbox'.. mine says 'html & javascript code'...
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.
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi49.tinypic.com%2F35a4uft.jpg&hash=835088b7029e700b2785c4a8d2c358e18c40be59)
Quote from: azGRUNT on February 26, 2010, 04:50:11 AM
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?
azGRUNT,
In case you haven't already figured this out, this code goes into an "html and javacript" block. Bluedevil's banners are designed to be used in the left or right panel because they are tall and thin but they could just as well be used in an upper or top panel block if your own banners are short and wide. If you want to see what they look like, visit my test site and look for the 2nd block down in the right panel. To center the banners like I did, add an opening center tag (<center>) at the top of the code and the closing tag (</center>) at the bottom of the code before pasting it into the block. Here's the link to my test site ...
http://talesofthehavenexpanse.com/smf1test/index.php
Shane,
After clicking the
<> that Ken mentioned, try selecting "all" in the block by hitting "<ctrl> A", hit the delete key, then paste the code in, and save it before doing anything else. Then just make sure the block is turned on, and set to show somewhere and check the page you're showing it on to see if it is there. If not, post back and we'll try something else.
Also, before starting all of this, make sure to change the links to reflect your own banners that you have already uploaded to the appropriate location, though Bluedevil's banners should show up until you do so.
ZarPrime
sorry guys, i used tp98 at the time. i would explain more but im getting medicated at this moment. just got home from surgery
Yes definately, I get that part... I press the html button, and I enter the code... see my attached snapshot...
Then, I can do two things:
(1) I can press the HIDE HTML button... But when i do this, it erases the code.. If i click on the html button again, the code is gone??
(2) or i can just press SAVE... but this has exact same results.. The code will be gone.. wether im in html view or HIDE html view.. theres nothing but an empty box.
and it also doesnt matter what code i enter because I tried this with another script code i found on TP site and the same thing happens...
ZarPrime --- I like your test site. :) Im about to go searching for some of those things you are testing out,..
let me ask you, IS the ADS test block available in code section? Im Asking because I'd like to use that code also in yteh future fro ads also. Now i see the difference, One is random while the other is rotating. both are great for different uses.
Quote from: bluedevil on February 26, 2010, 05:15:24 PM
sorry guys, i used tp98 at the time. i would explain more but im getting medicated at this moment. just got home from surgery
Sorry to hear that Bro'. Surgery is never a good thing, I can attest to that from experience. I hope everything is going good and you are starting to feel better. :up:
ZarPrime
Quote from: shane is my name on February 26, 2010, 11:26:22 PM
Then, I can do two things:
(1) I can press the HIDE HTML button... But when i do this, it erases the code.. If i click on the html button again, the code is gone??
(2) or i can just press SAVE... but this has exact same results.. The code will be gone.. wether im in html view or HIDE html view.. theres nothing but an empty box.
and it also doesnt matter what code i enter because I tried this with another script code i found on TP site and the same thing happens...
Shane,
Don't do number 1. Sometimes, with editors, clicking the "Hide html" link will add codes in there that mess up the result. This is what the problem is with using editors. This is one of the reasons I always have an external editor ready on my computer to be used when I'm coding html and javascript.
Anyway, when you use the #2 method, the answer is yes, the code will not be shown. What should be shown when you save is the actual result. If it isn't, then something else is going on there. If you then click the
<> button to see the code, this is often what messes things up so don't click that button to edit it after you have saved.
If you are having trouble doing this, another method to try is as follows ...
Instead of creating an html block, create a php block instead. Paste the code in and save it. When it comes back up, it will give you one or more errors in the block itself. At this point, the last thing to do is to go back into the block edit screen and change the block type from a php block to the appropriate block type, like html and javascript. This might make it work better.
ZarPrime
Quote from: shane is my name on February 26, 2010, 11:56:37 PM
ZarPrime --- I like your test site. :) Im about to go searching for some of those things you are testing out,..
let me ask you, IS the ADS test block available in code section? Im Asking because I'd like to use that code also in yteh future fro ads also. Now i see the difference, One is random while the other is rotating. both are great for different uses.
I appreciate that but the site is obviously just for testing code and other things that people are asking about here. It would probably make a good site to offer external support to people but, at least for now, I prefer to actually answer support questions here instead of having my own site dedicated to support. Others have done that, some with success and others, not so much. ;) Running a site like that can be a pain sometimes. I like the freedom of being here to help people when I have the time. That way, if I want to take a week or so off, there's nobody to complain about my absense when I'm not around. ;)
Anyway, the Ads Test block in the left panel just consists of code that someone gave me on here. Like you did in your other topic I posted to this morning, they gave me the code they were using and I pasted it into the block to make sure that it was working on the test site. I honestly never even went to Google to get the code. The user here supplied it. It's probably from Google Adsense or something like that but, to get the code, you probably have to register on their site.
ZarPrime
Sometimes i use coffeecup.com editor and http://www.openwebware.com/wysiwyg/demo.shtml
Yeah ZP, hydrocodone is my best friend at the moment :buck2:
One more thing.... google ads wont work with this script.
Only images and linked images ;)