vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How can I insert and image in Ads? (https://vborg.vbsupport.ru/showthread.php?t=261769)

Gloria Culver 04-10-2011 03:44 PM

How can I insert and image in Ads?
 
I have been wrestling with this one for a while. Tried searching but get errors. I hope someone can help. I would like to insert ads that consist of a banner sized image which is local to my server with a link to the customers website if available. I don't have customer code. Is this possible? Assistance would be much appreciated!

Frosty 04-10-2011 03:48 PM

Where would you like it aligned?!

Gloria Culver 04-10-2011 04:04 PM

Left or Center. Need to get it working then worry about the details.

Stefan118 04-10-2011 08:48 PM

Just use the folowing HTML:
HTML Code:

<center>
<a href="http://www.LinkToTheOtherWebsite.com"><img src="http://www.URLwhereYourBannerIsLocated.jpg" width="300" height="125" alt="Write here info about the advertiser"></a>
</center>


Gloria Culver 04-10-2011 09:07 PM

Wow! Thank you! This is the most progress I have made in weeks. Both ads are displaying. Can you tell me what template they are in so perhaps I can get them to rotate instead of stack?

Your help is really appreciated!

Stefan118 04-10-2011 10:06 PM

If you have multiple banners you want to show, and you want to show them random with every page refresh, you can use the next code.
This code is for 4 banners.
In this case your banners will be shown fully and will not be scaled, so you might have to scale them yourself.
Change the array into the amount of banners you have.

HTML Code:

<center>
<script language="JavaScript">

images = new Array(4); 

images[0] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";
images[1] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new>
<img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";
images[2] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";
images[3] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new>
<img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);

</script>
</center>

Just put it in:
admincp --> Advertising --> Manage Ads --> Add new ad

Gloria Culver 04-10-2011 11:18 PM

Again, thank you so very, very much!

--------------- Added [DATE]1302500002[/DATE] at [TIME]1302500002[/TIME] ---------------

Got some time this evening and substituted the rotating code for the static code. I must have something wrong because nothing is appearing. This is what I have:

<center>
<script language="JavaScript">

images = new Array(2);

images[0] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.jouster.com/forums/images/banner/otis.gif' alt='Hover text'></a>";
images[1] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.jouster.com/forums/images/banner/turnerslings.jpg'
alt='Hover text'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);

</script>
</center>

Is it correct or do I have a boo-boo that I just can't see?

Thank you again!

martar 07-25-2011 11:45 PM

Quote:

Originally Posted by Gloria Culver (Post 2183179)
[...]
Got some time this evening and substituted the rotating code for the static code. I must have something wrong because nothing is appearing. This is what I have:

<center>
<script language="JavaScript">

images = new Array(2);

images[0] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.jouster.com/forums/images/banner/otis.gif' alt='Hover text'></a>";
images[1] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.jouster.com/forums/images/banner/turnerslings.jpg'
alt='Hover text'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);

</script>
</center>

Is it correct or do I have a boo-boo that I just can't see?

[...]

There are missing some single quotes.

The error was in this (here corrected line) :

images[0] = "<a href = 'http://www.LinkToBannersWebsiteA.com' target='_blank'><img src='http://www.PlaceWhereTheBannerIsStored_a.gif' alt='Funny hover text'></a>";

Complete and correct code is:

HTML Code:

<center>
<script language="JavaScript">

images = new Array(4); 

images[0] = "<a href = 'http://www.LinkToBannersWebsiteA.com' target='_blank'><img src='http://www.PlaceWhereTheBannerIsStored_a.gif' alt='Funny hover text A'></a>";
images[1] = "<a href = 'http://www.LinkToBannersWebsiteB.com' target='_blank'><img src='http://www.PlaceWhereTheBannerIsStored_b.gif' alt='Sad hover text B'></a>";
images[2] = "<a href = 'http://www.LinkToBannersWebsiteC.com' target='_blank'><img src='http://www.PlaceWhereTheBannerIsStored_c.gif' alt='Stupid hover text C'></a>";
images[3] = "<a href = 'http://www.LinkToBannersWebsiteD.com' target='_blank'><img src='http://www.PlaceWhereTheBannerIsStored_d.gif' alt='Intelligent hover text D'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);

</script>
</center>


I also use target='_blank' instead of target='_new' but I don't know if this makes any difference, my programming days were somewhere back in the past...

I hope this helps somebody - at least to save some hours of searching the error. :D

Stefan118 09-20-2011 09:08 PM

Thanks for correcting :up:

I could have seen that there was something wrong by the colors of the code, but havent noticed it!

mradlin 01-15-2012 06:37 PM

Installed and working great!!
Thanks guys.


All times are GMT. The time now is 03:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01692 seconds
  • Memory Usage 1,744KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete