Please, help in template variables

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Caio Reis
Registered User
Posts: 2
Joined: Sun Apr 01, 2007 5:06 pm

Please, help in template variables

Post by Caio Reis »

Hi everbody, i'm a brazilian guy from phpBBrasil.com and i am doing a template for phpBB3 x.

I want to add new things, and one of them is to show this in overall_header:

Welcome to phpBBrasil {USERNAME}, the best portuguese phpBB support.

But there is the problem, in some pages, like profile and ucp, the variable shows the name, like that:
Welcome to phpBBrasil Caio Reis, the best portuguese phpBB support.

But this only works in thats pages than already has that code, like ucp and profile.
But in the pages that no show that code, like index.php, where doesn't have {USERNAME} code, shows this:
Welcome to phpBBrasil , the best portuguese phpBB support.


I am not very good in english, but i need help, someone knows how to help me??

Thanks a lot

User avatar
geoffreak
Registered User
Posts: 51
Joined: Mon Feb 28, 2005 4:36 pm
Contact:

Re: Please, help in template variables

Post by geoffreak »

includes/functions.php :D

add

Code: Select all

'USERNAME'			=> $user->data['username'],
after

Code: Select all

'PRIVATE_MESSAGE_INFO_UNREAD'	=> $l_privmsgs_text_unread,

User avatar
geoffreak
Registered User
Posts: 51
Joined: Mon Feb 28, 2005 4:36 pm
Contact:

Re: Please, help in template variables

Post by geoffreak »

you can also just use another variable:
jojobarjo32 wrote: The username is already available in every page :) Use the variable {S_USERNAME} ;)
However, if you want the colored username with link to the profile, you must add in functions.php, in the page_header function (line ~3935, after the S_USERNAME declaration):

Code: Select all

		'S_USERNAME_FULL'			=> get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']),

Caio Reis
Registered User
Posts: 2
Joined: Sun Apr 01, 2007 5:06 pm

Re: Please, help in template variables

Post by Caio Reis »

Thanks a lot man, can you just bring me the code to do the same thing with avatar??


Thanks

User avatar
geoffreak
Registered User
Posts: 51
Joined: Mon Feb 28, 2005 4:36 pm
Contact:

Re: Please, help in template variables

Post by geoffreak »

add

Code: Select all

// Grab Avatar Info
$avatar_img = '';

$sql = 'SELECT 
        user_id,
        user_avatar, 
        user_avatar_type, 
        user_avatar_width, 
        user_avatar_height
    FROM 
        ' . USERS_TABLE . "
    WHERE 
        user_id = " . $user->data['user_id'];

        $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{        
    if ($row['user_avatar'] && $user->optionget('viewavatars'))
    {
        $avatar_img = '';
        
        switch ($row['user_avatar_type'])
        {
            case AVATAR_UPLOAD:
                $avatar_img = $config['avatar_path'] . '/';
            break;

            case AVATAR_GALLERY:
                $avatar_img = $config['avatar_gallery_path'] . '/';
            break;
        }
        
        $avatar_img .= $row['user_avatar'];
        $avatar_img = '<img src="' . $avatar_img . '" width="' . $row['user_avatar_width'] . '" height="' . $row['user_avatar_height'] . '" alt="' . $username . '" title="' . $username . '" />';    
    }
}
$db->sql_freeresult($result);
after

Code: Select all

// Which timezone?
    $tz = ($user->data['user_id'] != ANONYMOUS) ? strval(doubleval($user->data['user_timezone'])) : strval(doubleval($config['board_timezone']));
add

Code: Select all

'USER_AVATAR'    => $avatar_img,
after

Code: Select all

'PRIVATE_MESSAGE_INFO_UNREAD'    => $l_privmsgs_text_unread,

User avatar
Handyman
Registered User
Posts: 522
Joined: Thu Feb 03, 2005 5:09 am
Location: Where no man has gone before!
Contact:

Re: Please, help in template variables

Post by Handyman »

GeoFreak, this is the wrong place.
Mods aren't supported here yet.
My phpBB3 Mods || My Mod Queue
Search Engine Friendly (SEO) URLs || Profile link on Avatar and/or Username || AJAX Chat
Display Posts Anywhere || CashMod || AJAX Quick Edit || AJAX Quick Reply

Image

User avatar
geoffreak
Registered User
Posts: 51
Joined: Mon Feb 28, 2005 4:36 pm
Contact:

Re: Please, help in template variables

Post by geoffreak »

Well mods won't matter as nobody is using them on an open board. ;)
Besides, I really wouldn't call this a mod... :roll:

User avatar
karlsemple
Registered User
Posts: 480
Joined: Mon Jan 23, 2006 8:49 am
Location: Hereford
Contact:

Re: Please, help in template variables

Post by karlsemple »

geoffreak wrote: Well mods won't matter as nobody is using them on an open board. ;)
Besides, I really wouldn't call this a mod... :roll:



Any alteration of the codebase no matter how small is a modifications and thus not supported during the beta stages and not in the styles forum either way :)

User avatar
geoffreak
Registered User
Posts: 51
Joined: Mon Feb 28, 2005 4:36 pm
Contact:

Re: Please, help in template variables

Post by geoffreak »

karlsemple wrote:
geoffreak wrote: Well mods won't matter as nobody is using them on an open board. ;)
Besides, I really wouldn't call this a mod... :roll:



Any alteration of the codebase no matter how small is a modifications and thus not supported during the beta stages and not in the styles forum either way :)


Alright.
My apologies :roll:

harmlessgoat22
Posts: 108
Joined: Sun Nov 27, 2005 12:25 am

Re: Please, help in template variables

Post by harmlessgoat22 »

Why are we yelling at Geoffreak? He didn't start the topic, he just answered it.
alphaPORTAL
phpBB3 Integration MOD:
Create Pages in phpBB3
Portal
Many Modules including Login, Welcome, Search, Top Posters, Online Now, Menu, Offsite Links, and more

Post Reply