Ad color mod

Any feature requests, please post here.
Post Reply
River
Posts: 124
Joined: Sat Feb 10, 2007 9:51 pm

Ad color mod

Post by River »

There's a mod written by Cyberalien for sebflipper MF that automatically change ad colors so it blend in and looks better at the forums.
Adsense per-template colors
This simple mod automatically modifies adsense colors depending on what template user is using so ads color would match current template color. It can also be quickly adjusted for yahoo ads.
Well SEBflipper seems like a not so good MF script but there seem to be many cool mods done for it, many by this guy cyberalien.

Anyone here a former sebflipper customer that got access to their mod forums? If so maybe we could see if we can make a version of it for echophp and maybe other interesting mods.

This is the URL for their mod forum but I don't have access to it. I think I remember reading there are some people here from SEB though....: http://forums.sebflipper.com/viewtopic.php?t=1583
Luke Beale
Posts: 17
Joined: Fri Feb 09, 2007 1:47 am

Post by Luke Beale »

This mod can change adsense colors for muiltiforum ads depending on current template.

How it works: you create file adsense.cfg in some template's directory, put colors in it and script will replace your default colors with custom colors if forum user uses that template.

Installation:

open includes/functions.php, find this:

Code: Select all

		$current_template_path = $template_path . $template_name;
		@include($phpbb_root_path . $template_path . $template_name . '/' . $template_name . '.cfg');

		if ( !defined('TEMPLATE_CONFIG') )
		{
			message_die(CRITICAL_ERROR, "Could not open $template_name template config file", '', __LINE__, __FILE__);
		}

		$img_lang = ( file_exists(@phpbb_realpath($phpbb_root_path . $current_template_path . '/images/lang_' . $board_config['default_lang'])) ) ? $board_config['default_lang'] : 'english';

		while( list($key, $value) = @each($images) )
		{
			if ( !is_array($value) )
			{
				$images[$key] = str_replace('{LANG}', 'lang_' . $img_lang, $value);
			}
		}
or, if you are using eXtreme Styles mod multiforums edition then instead of code above open includes/template.php and find this:

Code: Select all

		while( list($key, $value) = @each($images) )
		{
			if ( !is_array($value) )
			{
				$images[$key] = str_replace('{LANG}', 'lang_' . $img_lang, $value);
			}
		}
and add after it

Code: Select all

		$adsense_file = $phpbb_root_path . $template_path . $template_name . '/adsense.cfg';
		if(@file_exists($adsense_file))
		{
			$adsense = array(
				'google_color_border'	=> $row['td_color2'],
				'google_color_bg'		=> $row['td_color2'],
				'google_color_link'		=> $row['body_link'],
				'google_color_url'		=> $row['body_hlink'],
				'google_color_text'		=> $row['body_text'],
			);
			@include($adsense_file);
			if(count($adsense))
			{
				global $multiforums_setting;
				$items = array('advert_top', 'advert_bottom');
				$search = array();
				$replace = array();
				for($i=0; $i<count($items); $i++)
				{
					if(strpos($multiforums_setting[$items[$i]], 'google_ad_client') > 0)
					{
						// do replacements
						if(!count($search))
						{
							foreach($adsense as $var => $value)
							{
								if(strlen($value) == 6)
								{
									$search[] = '/' . $var . ' = \"([0-9a-fA-F]+)\"/';
									$replace[] = $var . ' = "' . $value . '"';
								}
							}
						}
						$multiforums_setting[$items[$i]] = preg_replace($search, $replace, $multiforums_setting[$items[$i]]);
					}
				}
			}
		}
Here are few prebuilt adsense.cfg files for few styles: http://www.trushkin.biz/temp/adsense.zip

That pack includes adsense.cfg for following styles:
- AcidTech (and its color schemes)
- Aeolus
- Artemis
- Athena
- Aphrodite (and Aphrodite Green)
- Classic (and Classic 2.0)
- Christmas
- Counter-Strike
- Eos
- Getaway
- Helius (and HeliusGray)
- Hestia
- Iris
- Jet
- Morpheus
- subSilver

Note: in prebuilt adsense.cfg pack subSilver's adsense.cfg is built in such way so if user changes colors in admin control panel adsense colors will also change to merge with forum.

Sample adsense.cfg that you should put in templates/whatever/adsense.cfg:

Code: Select all

<?php

$adsense = array(
	'google_color_border'	=> '191919',
	'google_color_bg'		=> '191919',
	'google_color_link'		=> '2370B6',
	'google_color_url'		=> 'F0E80A',
	'google_color_text'		=> 'D0D0D0',
);

?>
River
Posts: 124
Joined: Sat Feb 10, 2007 9:51 pm

Post by River »

Nice, seems like a really good mod. 8)
River
Posts: 124
Joined: Sat Feb 10, 2007 9:51 pm

Post by River »

Anyone tried this mod for echophpmf? Echo, if you're reading this, do you think it's compatible? I think the code might be for seb's script.


Anyway, I can not find the code below in my /includes/template.php
or, if you are using eXtreme Styles mod multiforums edition then instead of code above open includes/template.php and find this:Code:
while( list($key, $value) = @each($images) )
{
if ( !is_array($value) )
{
$images[$key] = str_replace('{LANG}', 'lang_' . $img_lang, $value);
}
}

and add after it
River
Posts: 124
Joined: Sat Feb 10, 2007 9:51 pm

Post by River »

Tried to mess with this again but I could not get it to work.

I think this mod is made for sebflippers and might need some small adjustments to work with echophp mf.

Anyone got any ideas? Echo?
echophp
Posts: 657
Joined: Sun Feb 11, 2007 9:07 am

Post by echophp »

Hi,

I did it for the version 2, you do not need to put adsense.cfg for each template, you will control it via your echoMF admin.

Thank you.
River
Posts: 124
Joined: Sat Feb 10, 2007 9:51 pm

Post by River »

wow, that's great :)
Post Reply