[MODDB] Custom Header Logo 1.2.7 (with bg and custom pages)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Ideas Centre
User avatar
knmt
Registered User
Posts: 110
Joined: Fri Aug 29, 2008 10:13 am
Contact:

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by knmt » Sat Dec 06, 2008 2:25 pm

Hi, this mod is a very nice one ;) . Thank to you.

I've modified some of your codes to add more features to my board. The additional features are:
  1. Add Width, Height, Background color to the custom header so you can easily use any kinds of banner.
  2. Add random header feature, which will show a random header when you access my board.
  3. The random header feature will not affect a specific forum's custom header, i.e. when you visit a forum with a custom header assigned to it, the custom header will be shown instead of random headers.
  4. Both features can be turn off in ACP -> General -> Board Settings. The benefit is when you want to turn off custom header on every forum.
You can see all in actions on my board, here.

@Balint: Consider this a mod to your mod XD!

Again, thanks Balint for this mod :)

User avatar
darkonia
Registered User
Posts: 1901
Joined: Tue May 13, 2008 1:10 pm
Location: Munich, Germany
Contact:

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by darkonia » Sat Dec 06, 2008 3:54 pm

can you post your changes as a little addon?
MMOG-Heaven - Das Gaming Portal
Community bedeutet Gleichgesinnte finden - MMOG-Heaven ist Deine Community! Von Spielern für Spieler bietet Dir dieses Portal genau das, was ein Spieler braucht. Bleibe ständig informiert, finde die neuesten MMORPGs, oder suche die frischesten News aus der Welt des Online Gamings - dieses und vieles mehr erwartet Dich auf MMOG-Heaven.

dapee
Registered User
Posts: 7
Joined: Sat Dec 06, 2008 9:36 pm

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by dapee » Sat Dec 06, 2008 10:10 pm

Little problem here. I installed the mod and I can see the input fields in acp for custom logo and header.
When I want to chose an image (I uploaded some in the folders images/logos and images/backgrounds), I can't see any of them.
Do these two folders have specific place where they should be?
Is there a possibillity somewhere to change the path?
Or do they need another chmod?

ps sql is ok, the fields are in the table

Thanks

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by Balint » Sun Dec 07, 2008 10:05 am

@all: dapee posted his solution here.

User avatar
knmt
Registered User
Posts: 110
Joined: Fri Aug 29, 2008 10:13 am
Contact:

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by knmt » Sun Dec 07, 2008 3:14 pm

darkonia wrote:can you post your changes as a little addon?
Of course, but I will post them later ;) .

User avatar
darkonia
Registered User
Posts: 1901
Joined: Tue May 13, 2008 1:10 pm
Location: Munich, Germany
Contact:

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by darkonia » Sun Dec 07, 2008 3:17 pm

knmt wrote:
darkonia wrote:can you post your changes as a little addon?
Of course, but I will post them later ;) .
Great Thx :D
MMOG-Heaven - Das Gaming Portal
Community bedeutet Gleichgesinnte finden - MMOG-Heaven ist Deine Community! Von Spielern für Spieler bietet Dir dieses Portal genau das, was ein Spieler braucht. Bleibe ständig informiert, finde die neuesten MMORPGs, oder suche die frischesten News aus der Welt des Online Gamings - dieses und vieles mehr erwartet Dich auf MMOG-Heaven.

User avatar
ChecMark
Registered User
Posts: 78
Joined: Tue Dec 16, 2008 10:10 pm
Name: Gary Jones

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by ChecMark » Sat Dec 27, 2008 8:58 pm

Sorry, new to php. Will this MOD work to change banner ads in the footer? I would like to have a specific banner ad, in rotation if at all possible, for each topic. Is that possible?

Thanks.

Gary

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by Balint » Sat Dec 27, 2008 9:14 pm

Hi,

I're recommend the Advertisement Management MOD for that purpose.


Greets,
Bálint

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Re: [RC] Custom Header Logo 1.2.0 (w/ custom header backgrounds)

Post by Balint » Sun Dec 28, 2008 2:50 pm

MOD updated to version 1.2.1
(see first post for updated link)

Changes:
- valid XHTML for the images
- background images get repeated vertically

Instructions for subsilver:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
styles/subsilver2/template/overall_header.html

#
#-----[ FIND ]------------------------------------------
#
</head>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- IF SITE_BG_IMG -->
<style type="text/css">
<!--
#logodesc {background-image:url("{SITE_BG_IMG}");}
-->
</style>
<!-- ENDIF -->

User avatar
knmt
Registered User
Posts: 110
Joined: Fri Aug 29, 2008 10:13 am
Contact:

Re: [RC] Custom Header Logo 1.2.1 (w/ custom header backgrounds)

Post by knmt » Wed Dec 31, 2008 4:02 pm

Okay so below are my additions to this mod, in case some of you need them. Consider this a new year eve's gift:-P

SQL Commands:

Code: Select all

ALTER TABLE phpbb_forums ADD forum_background_logo_color VARCHAR(255) NOT NULL;
ALTER TABLE phpbb_forums ADD forum_background_logo_width mediumint(8) UNSIGNED NOT NULL DEFAULT 900;
ALTER TABLE phpbb_forums ADD forum_background_logo_height mediumint(8) UNSIGNED NOT NULL DEFAULT 200;
INSERT INTO phpbb_config (config_name, config_value) VALUES ('rh_enable', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ch_enable', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('logo_rbackground_path', 'images/rbackgrounds');
With rbackground path being your random background directory, just like images/background, also put in images/

Open: adm/style/acp_forums.html
Find

Code: Select all

	<dl>
		<dt><label for="forum_password">{L_FORUM_PASSWORD}:</label><br /><span>{L_FORUM_PASSWORD_EXPLAIN}</span></dt>
Add before

Code: Select all

<dl>
	    <dt><label for="forum_background_logo_color">{L_FORUM_BACKGROUND_COLOR}:</label></dt>
	    <dd><input class="text small" type="text" id="forum_background_logo_color" name="forum_background_logo_color" value="{FORUM_BACKGROUND_LOGO_COLOR}" size="6" maxlength="6" />&nbsp;&nbsp;<span>[ <a href="{U_SWATCH_LOGO}" onclick="popup(this.href, 636, 150, '_swatch'); return false">{L_COLOUR_SWATCH}</a> ]</span></dd>
	</dl>  
    <dl>
	    <dt><label for="forum_background_logo_width">{L_FORUM_BACKGROUND_WIDTH}:</label></dt>
	    <dd><input class="text small" type="text" id="forum_background_logo_width" name="forum_background_logo_width" value="{FORUM_BACKGROUND_LOGO_WIDTH}" size="6" maxlength="6" /></dd>
	</dl>  
    <dl>
	    <dt><label for="forum_background_logo_height">{L_FORUM_BACKGROUND_HEIGHT}:</label></dt>
	    <dd><input class="text small" type="text" id="forum_background_logo_height" name="forum_background_logo_height" value="{FORUM_BACKGROUND_LOGO_HEIGHT}" size="6" maxlength="6" /></dd>
	</dl>
Open: includes/acp/acp_board.php
Find

Code: Select all

'warnings_expire_days'	=> array('lang' => 'WARNINGS_EXPIRE',		'validate' => 'int',	'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
Add after

Code: Select all

/* Custom Header mod */
						'legend3'				=> 'CUSTOM_HEADER',
						'rh_enable'				=> array('lang' => 'YES_RANDOM_HEADER',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),
						'ch_enable'				=> array('lang' => 'YES_CUSTOM_HEADER',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),
						/* Custom Header mod */
Open: language/en/acp/common.php
Find

Code: Select all

?>
Add before

Code: Select all

// Custom Header mod
$lang = array_merge($lang, array(
	'CUSTOM_HEADER'			=> 'Header editor',
));
Open: language/en/acp/board.php
Find

Code: Select all

?>
Add before

Code: Select all

// Custom header mod
$lang = array_merge($lang, array(
	'YES_RANDOM_HEADER'				=> 'Enable random header',
	'YES_RANDOM_HEADER_EXPLAIN'		=> 'Allow the board to have random headers background. If Custom header is also enabled, random header will not appear on forum which has its own header.',	
	'YES_CUSTOM_HEADER'				=> 'Enable custom header',
	'YES_CUSTOM_HEADER_EXPLAIN'		=> 'Allow the board to have custom headers background for a specific forum.',	
));
Open: language/en/mods/custom_header.php
Find

Code: Select all

'FORUM_BACKGROUND'					=> 'Forum header background',
Add after

Code: Select all

'FORUM_BACKGROUND_COLOR'			=> 'Forum header background color',
	'FORUM_BACKGROUND_WIDTH'			=> 'Forum header background width',
	'FORUM_BACKGROUND_HEIGHT'			=> 'Forum header background height',
Open: includes/acp/acp_forums.php
Find

Code: Select all

'forum_background_logo'	=> request_var('forum_background_logo', ''),
Add after

Code: Select all

'forum_background_logo_color' => request_var('forum_background_logo_color', ''),
						'forum_background_logo_width' => request_var('forum_background_logo_width', ''),						
						'forum_background_logo_height' => request_var('forum_background_logo_height', ''),
Find

Code: Select all

'S_FORUM_BACKGROUND_OPTIONS'=> $logo_list_bg,
Add after

Code: Select all

'FORUM_BACKGROUND_LOGO_COLOR'  => $forum_data['forum_background_logo_color'],
					'FORUM_BACKGROUND_LOGO_WIDTH'  => $forum_data['forum_background_logo_width'],					
					'FORUM_BACKGROUND_LOGO_HEIGHT' => $forum_data['forum_background_logo_height'],
Find

Code: Select all

'forum_link_track'		=> false,
	  'forum_desc'			=> '',
Add after

Code: Select all

'forum_background_logo_width' => '0',						
	'forum_background_logo_height' => '0',
Open: includes/functions_admin.php
Find

Code: Select all

/**
* Get physical file listing
*/
Comment out the filelist function

Open: includes/functions.php
Find

Code: Select all

// Common global functions
Add after

Code: Select all

/**
* Get physical file listing
*/
function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png')
{
	$matches = array();

	// Remove initial / if present
	$rootdir = (substr($rootdir, 0, 1) == '/') ? substr($rootdir, 1) : $rootdir;
	// Add closing / if not present
	$rootdir = ($rootdir && substr($rootdir, -1) != '/') ? $rootdir . '/' : $rootdir;

	// Remove initial / if present
	$dir = (substr($dir, 0, 1) == '/') ? substr($dir, 1) : $dir;
	// Add closing / if not present
	$dir = ($dir && substr($dir, -1) != '/') ? $dir . '/' : $dir;

	if (!is_dir($rootdir . $dir))
	{
		return $matches;
	}

	$dh = @opendir($rootdir . $dir);

	if (!$dh)
	{
		return $matches;
	}

	while (($fname = readdir($dh)) !== false)
	{
		if (is_file("$rootdir$dir$fname"))
		{
			if (filesize("$rootdir$dir$fname") && preg_match('#\.' . $type . '$#i', $fname))
			{
				$matches[$dir][] = $fname;
			}
		}
		else if ($fname[0] != '.' && is_dir("$rootdir$dir$fname"))
		{
			$matches += filelist($rootdir, "$dir$fname", $type);
		}
	}
	closedir($dh);

	return $matches;
}
Find

Code: Select all

//Custom Header Logo.....//Custom Header Logo
Replace with

Code: Select all

// Custom Header Logo
	$site_logo = $user->img('site_logo');
	$site_background_logo = '';
	$site_background_logo_color = '000000';
	$site_background_logo_width = '922';
	$site_background_logo_height = '175';
	// Random headers
	if ($config['rh_enable']) 	
	{
		$imglist_bg = filelist($phpbb_root_path . $config['logo_rbackground_path'], '');		
		foreach ($imglist_bg as $path => $img_ary)
			{
				$site_background_logo_num = rand(0,count($img_ary)-1);
				$site_background_logo = $phpbb_root_path . $config['logo_rbackground_path'] . '/' . $path . $img_ary[$site_background_logo_num];				
				list($site_background_logo_width,$site_background_logo_height) = getimagesize($site_background_logo);
				if ($site_background_logo_width > 922) {$site_background_logo_width = 922;}
			}
	}
	// Custom header for a specific forum
	if ($config['ch_enable']) {
	if (!empty($_REQUEST['f']) && !is_array($_REQUEST['f'])) 
	{
		$forum_id = request_var('f', 0);
		$sql = 'SELECT forum_logo, forum_background_logo, forum_background_logo_color,  forum_background_logo_width, forum_background_logo_height
			FROM ' . FORUMS_TABLE . '
			WHERE forum_id = ' . $forum_id;
		$result = $db->sql_query($sql);
		$forum_logo = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		if (!empty($forum_logo['forum_logo']))
		{
			$site_logo = '<img src="' . $phpbb_root_path . $config['logo_path'] . '/' . $forum_logo['forum_logo'] . '">';
		}
		if (!empty($forum_logo['forum_background_logo']))
		{
			$site_background_logo = $phpbb_root_path . $config['logo_background_path'] . '/' . $forum_logo['forum_background_logo'];
		}
		if (!empty($forum_logo['forum_background_logo_color']))
		{
			$site_background_logo_color = $forum_logo['forum_background_logo_color'];
		}
		if (!empty($forum_logo['forum_background_logo_width']))
		{
			$site_background_logo_width = $forum_logo['forum_background_logo_width'];
		}
		if (!empty($forum_logo['forum_background_logo_height']))
		{
			$site_background_logo_height = $forum_logo['forum_background_logo_height'];
		}		
	}
	}
	// Custom Header Logo
=> which means you replace the code in the modified block by Balint with the code I provided.

Find

Code: Select all

'SITE_BG_IMG'			=> $site_background_logo,
Add after

Code: Select all

'SITE_LOGO_IMG' 		=> $site_logo,
		'SITE_BG_COLOR'			=> $site_background_logo_color,
		'SITE_BG_WIDTH'			=> $site_background_logo_width,
		'SITE_BG_HEIGHT'		=> $site_background_logo_height,
Open: styles/prosilver/template/overall_header.html
Find

Code: Select all

<!-- IF SITE_BG_IMG -->
Add after

Code: Select all

<style type="text/css">
<!--
.headerbar {background-image: url({SITE_BG_IMG}); background-color: #{SITE_BG_COLOR}; height: {SITE_BG_HEIGHT}px; width: {SITE_BG_WIDTH}px; margin:auto;}
-->
</style>
<!-- ENDIF -->
You can apply similar changes to subsilver-based styles.

Please note that these additions are by no mean supported or approved by the author. If you have any questions or suggestions, please feel free to reply. Any bug, security holes, etc. please also reply. Thank you and HAPPY NEW YEAR :)

P.S. : You also have to change some codes to update this mod to its latest version.
Last edited by knmt on Tue Jan 27, 2009 9:12 am, edited 3 times in total.

User avatar
DragonMaster1
Registered User
Posts: 994
Joined: Tue Aug 17, 2004 11:04 am
Name: Terry
Contact:

Re: [RC] Custom Header Logo 1.2.1 (w/ custom header backgrounds)

Post by DragonMaster1 » Wed Dec 31, 2008 5:01 pm

Thanx....I need to work on installing this as soon as I find the right images to use

Thanx Much and have a HAPPY NEW YEAR :D

win_xp_devilsown
Registered User
Posts: 30
Joined: Sun Oct 14, 2007 4:34 am
Location: Kiwi Land
Contact:

Re: [RC] Custom Header Logo 1.2.1 (w/ custom header backgrounds)

Post by win_xp_devilsown » Wed Dec 31, 2008 10:06 pm

Bit of a problem....

Installed this mod using AutoMOD....gave any error that it couldnt find a couple of line in "includes/acp/acp_board.php" so editted manually. Made the images directories and changed the permissions to 777 . When i go to click on the forums i get this error......

SQL ERROR [ mysql4 ]

Unknown column 'forum_logo' in 'field list' [1054]

SQL

SELECT forum_logo, forum_background_logo FROM phpbb3_forums WHERE forum_id = 1

BACKTRACE


FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()

FILE: includes/functions.php
LINE: 3672
CALL: dbal_mysql->sql_query()

FILE: viewforum.php
LINE: 142
CALL: page_header()


Have uninstalled using autoMOD, but still get that error.....i assume i need to do something in the database ( have access to phpmyadmin) but dont know what to do..... any cluses please?

Also.....i tried restring my backup thru phpBB but it "times out", so cant do that.

this is the sql command that was used ....

Code: Select all

ALTER TABLE phpbb3_forums ADD forum_logo VARCHAR(255) NOT NULL;
ALTER TABLE phpbb3_forums ADD forum_background_logo VARCHAR(255) NOT NULL;
INSERT INTO phpbb3_config (config_name, config_value) VALUES ('logo_path', 'images/logos');
INSERT INTO phpbb3_config (config_name, config_value) VALUES ('logo_background_path', 'images/backgrounds');
..

So what what be the unstall command for this ?

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Re: [RC] Custom Header Logo 1.2.1 (w/ custom header backgrounds)

Post by Balint » Wed Dec 31, 2008 10:25 pm

Hi,

AutoMOD is in BETA and should not be used in live environments. Please make sure with phpMyAdmin that the mentioned changes were done. it should be no problem to repeat the commands you posted in phpMyAdmin - please make a backup of the database first.


Greets,
Bálint

User avatar
JessieBlue
Registered User
Posts: 54
Joined: Mon Aug 25, 2008 6:48 pm
Contact:

Re: [RC] Custom Header Logo 1.2.1 (w/ custom header backgrounds)

Post by JessieBlue » Thu Jan 01, 2009 4:42 pm

Hello,
Can this modification be implemented without altering the tables?
I'm a begginer phpBB user, but I don't like the idea of extensions/modifications that need altering the tables.
Danny
My forum: PC Adviser Forum
My shop:PC Adviser

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Re: [RC] Custom Header Logo 1.2.1 (w/ custom header backgrounds)

Post by Balint » Thu Jan 01, 2009 5:33 pm

Hi,

there's no efficient way to do this without database altering. When you don't feel comfortable altering the DB, then I'm sorry but you can't use this MOD :-(


Greets,
Bálint

Locked

Return to “[3.0.x] MODs in Development”