News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Simple Ad Rotator

Started by Nick Whetstone, April 17, 2009, 10:35:59 AM

Previous topic - Next topic

WaveZtream


Nick Whetstone

Sorry for the delay... try this:
/Themes/Darkbreak/index.template.php
Code (find) Select
// Show the navigation tree.
theme_linktree();
Code (Replace with) Select
// Begin Simple Ad Rotator - Top Ad
if (!empty($modSettings['random_ad_top']) && !empty($modSettings['random_ad_top_enable']))
{

// Seperate the quotes from each other.
$quotes_top = explode("\n", $modSettings['random_ad_top']);

// Number of different quotes
$num_quotes_top = count($quotes_top)-1;

// A random number
$number_top = mt_rand(0,$num_quotes_top);

echo'' .parse_bbc($quotes_top[$number_top]). '';
}
// Show the navigation tree.
theme_linktree();
Code (Find) Select
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
Code (Replace with) Select

   global $modSettings;
// Begin Simple Ad Rotator - Bottom Ad
if (!empty($modSettings['random_ad_bottom']) && !empty($modSettings['random_ad_bottom_enable']))
{

// Seperate the quotes from each other.
$quotes_bottom = explode("\n", $modSettings['random_ad_bottom']);

// Number of different quotes
$num_quotes_bottom = count($quotes_bottom)-1;

// A random number
$number_bottom = mt_rand(0,$num_quotes_bottom);

echo'' .parse_bbc($quotes_bottom[$number_bottom]). '';
}
// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!


Let me know how that looks. No guarantee that it'll look pretty like that. :P

If you need help styling it, feel free to say so.
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

WaveZtream

Thx for the help that worked like a charm :D

aussieherps

Quote from: aussieherps on March 04, 2010, 08:50:02 PM
Have added this to my rc2 forum and no ads are showing on top rotator. Have not tried the bottom rotator.
Code used is:
[URL=http://nevilleburns.net][img width=600 height=74]http://img299.imageshack.us/img299/4743/82248290411.jpg[/img][/URL]
and is posted as such.
Any help would be greatful.
Any help with this one or advice would be appreciated....
http://aussieherps.com">snakes lizards spiders turtles and much more

Nick Whetstone

Have you made sure the "Enable top rotator" box is ticked and that there are no line breaks? Also, did the Mod fail any tests on installation?
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

aussieherps

Can't remember if there was any fails. if there were I would have parsed them for install....I think thats what you call it.
Yes the rotator has all been set up with the top box ticked, just no ads showing.
Doesn't bother me too much as if I just post ads in the same area the Ad mod rotates them regularly on refreshed pages.
http://aussieherps.com">snakes lizards spiders turtles and much more

EGCoopey

what would prevent a ad from showing up 1 out of 3 hard refreshes? i am running 3 rotating ads and they only show up randomly. Sometimes nothing shows up, sometimes only the lower shows up, sometimes they both upper and lower will show up.

Running RC5 on Krilliun Theme.

TheListener

Are they on different lines ie

Like this

and not like this when
you added the nexr ad?

tassie73

Hi,

i am using the DarkMark theme and am trying to get the mod to run, but with no luck..... If I replace all the stuff as in the darkbreak theme, will it work?

Cheers

Chris

katiespickles

I have all kinds of errors....
?????  :'(

TheListener

Quote from: katiespickles on August 28, 2011, 02:56:29 PM
I have all kinds of errors....
?????  :'(

Unless you plan on using the Core theme then you only have one error.

The error is a test failed which means you have to manually edit the file.

katiespickles

Quote from: Brack1 on August 28, 2011, 04:42:08 PM
Quote from: katiespickles on August 28, 2011, 02:56:29 PM
I have all kinds of errors....
?????  :'(

Unless you plan on using the Core theme then you only have one error.

The error is a test failed which means you have to manually edit the file.

I'm using Headline, so I have 3...?

TheListener


katiespickles


TheListener

Unless headline uses the core them then no you don't have 3 errors.

Also nobody can help if the forum is not open to guests in fact if I were a guest I would not stay any longer than  a second if I had to register at a forum before viewing it.

TheListener

Er I need to wear glasses

Katie you are indeed correct there were more than 1 edit.

( hey is is 3:30am)

Do you know how to leave your index.template file as an attachment so someone can have a look for you?

:-[ :-[ :-[


katiespickles

No I don't :((( I'll poke around & see what I can find

and it's all private because there will be personal info up. I'm moving 1500 people from a Facebook group over to here, so hopefully they'll stick around for more than a minute or two ;)

bloodsong

heyas guys!

   thanks for the great mod/s --  random quote and the ad rotator!  the old random quote didnt work with my 2.0 board, so i'm using this one, now.  it's really nice!

but...

   i always have to tinker.   i don't know css/php, exactly.  i have firebug, and i guess a lot.

   what i would like to do is get the ad rotator centered and NOT go across the whole width of the header.  i've been doing this the low-tech way by using a centered table with a fixed width directly on the 'ad' line.  then i wanted to put it under the site logo/search and the user info/login stuff.   annnnnnd, i'm having problems.

1:  if i use the table-in-ad-line (in the control panel) method, the text turns brown, when i want it to be the standard body colour of dark powder blue.  i tried making a new class called "quote" with that colour in the css, but that didn't help. (and added div class="quote" to the ad line code.)

2:  when i use the table below the login header stuff, just above the first br class = "clear", the entire rest of the forum layout is wrong.  that is, the table it uses is the wrong width.  and i don't know why it is 'losing' its proper width.

3:  when i take OUT the table code below the login/header stuff, the rest of the page displays the proper width.  and my text is the proper colour.  however, it starts above the site slogan, continues below the news/search line, and takes up the whole width of the header.


   if i want the ad centered, with a fixed width, in the header under the login and stuff, just above the location tree line; can i change the ad rotator php code to accomplish that?  or is that some kind of java going on in there? i DEFINITELY cannot touch java.  can i apply any kind of wrapper to the ad rotator?  height, width, text colours...?  or does that all have to go in the data area for each 'ad' line?

   any ideas?  oh, i am using a modified cataclysm theme.  i dont think the theme bothered it; everything worked right.  i just dont understand why using a table in the quote caused the forum body table to flake out.

bloodsong

heyas!

  never mind, i got it set up the way i wanted!  i just used a good old old-school TABLE!  ;D  and i used it for the user info, the rotator, and the slogan/search.  and finally got the slogan/search to not go wiggy when someone isn't logged in.  much better than that align left align right stuff :X


   super cool mod; i love it!!

you can see it here if you want:
http://bldsong.net/dabz/index.php [nofollow]

wole8029

hello please how can i get this to work in my smf 2.0.1

Advertisement: