Page 1 of 1
Welcom on overall header
Posted: 24 May 2011, 17:46
by uzidesign
Hi,
Can you help me with code?
I want to show welcome in all pages (search, viewtopic, viewforum etc')
Thanks
Re: Welcom on overall header
Posted: 25 May 2011, 09:32
by Stoker
Basicly you need to put the index.php code in search.php etc.
The best way would be adding it to functions.php but that would require some custom coding.
Re: Welcom on overall header
Posted: 29 May 2011, 07:29
by kevinviet
Hi Stoker, this Welcome on index mod here is just the same version 1.0.2 in phpBB data base ? or you updated new version ?
Thanks
Re: Welcom on overall header
Posted: 29 May 2011, 07:30
by Stoker
Its the same.
Re: Welcom on overall header
Posted: 29 May 2011, 07:47
by kevinviet
Thanks, i have the latest version
Welcom on overall header
Posted: 15 Aug 2011, 21:11
by VOLKERMORD
Find in
includes/functions.php
Code: Select all
// The following assigns all _common_ variables that may be used at any point in a template.
Before add:
Code: Select all
// BEGIN Welcome Mod
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');
if ($user->data['is_registered'])
{
$u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
$u_user_name = $user->lang['WELCOME_GUEST'];
}
switch (true)
{
case ($date < 1):
// if the hour is 11am-12am (18-23)
$s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
break;
case ($date < 4):
// if the hour is 1-3 am
$s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
break;
case ($date < 8):
// if the hour is 4-7 am
$s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
break;
case ($date < 12):
// if the hour is 8-11 am
$s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
break;
case ($date < 18):
// if the hour is 12-5pm
$s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
break;
case ($date < 24):
// if the hour is 6pm-11pm
$s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
break;
}
// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
$member_length = time() - $user->data['user_regdate'];
$years = $months = $days = 0;
$member_for = '';
if ($member_length)
{
if ($member_length >= 31536000)
{
$years = floor($member_length / 31536000);
$member_length = $member_length - ($years * 31536000);
$member_for .= $years > 1 ? ($years . ' ' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . ' ' . $user->lang['WELCOME_YEAR'] . ', ');
}
$months = floor($member_length / 2628000);
if ($months)
{
$months = $months > 1 ? ($months . ' ' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . ' ' . $user->lang['WELCOME_MONTHS'] . ', ');
$member_length = $member_length - ($months * 2628000);
$member_for .= $months;
}
$days = floor($member_length / 86400);
if ($days)
{
$days = $days > 1 ? ($days . ' ' . $user->lang['WELCOME_DAYS']) : ($days . ' ' . $user->lang['WELCOME_DAY']);
$member_for .= $days;
}
}
}
//END Welcome Mod
Find in
includes/functions.php
Code: Select all
'S_USER_NEW' => $user->data['user_new'],
After add:
Code: Select all
// BEGIN Welcome Mod
'S_WELCOME' => $s_welcome,
'S_JOINED_DATE' => $user->lang['JOINED'] . ': ' . $user->format_date($user->data['user_regdate']),
'USER_AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
'MEMBER_FOR' => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . ' ' . $member_for : '',
// END Welcome Mod
use this code in your
overall_header.html
Code: Select all
<!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" width="45px" height="45px" alt="" /><!-- ENDIF -->
Welcom on overall header
Posted: 16 Aug 2011, 00:00
by martin123456
failed on my test board unless i put this part
<!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" width="45px" height="45px" alt="" /><!-- ENDIF -->
in the wrong place
Welcom on overall header
Posted: 26 Aug 2011, 13:02
by VOLKERMORD
After I changed overall_header.html it is look very nice