Templating ... a simple guide

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Post Reply
User avatar
Highway of Life
Registered User
Posts: 1399
Joined: Tue Feb 08, 2005 10:18 pm
Location: I'd love to change the World, but they won't give me the Source Code
Contact:

Re: Templating ... a simple guide

Post by Highway of Life »

No problem. :D

Sort?!?

OH, well... you would want to run a small query and left join the ranks table to pull the rank image and text.
Image

User avatar
DarsVaeda
Registered User
Posts: 87
Joined: Thu Feb 03, 2005 11:15 pm
Location: Germany
Contact:

Re: Templating ... a simple guide

Post by DarsVaeda »

if i need custom database-tables i don't get around using php, do i?
"They say time is the fire in which we burn."

TerraPedia.org

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

Re: Templating ... a simple guide

Post by Handyman »

to create custom database tables, you wouldn't need to use php… unless you wanted to use them.
So no, you wouldn't get around it.
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
DarsVaeda
Registered User
Posts: 87
Joined: Thu Feb 03, 2005 11:15 pm
Location: Germany
Contact:

Re: Templating ... a simple guide

Post by DarsVaeda »

i mean if i create a new table and want to work with the data in my templates, i would need php for that, right?
"They say time is the fire in which we burn."

TerraPedia.org

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

Re: Templating ... a simple guide

Post by Handyman »

DarsVaeda wrote:i mean if i create a new table and want to work with the data in my templates, i would need php for that, right?
yes Darth.
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

geckzilla
Registered User
Posts: 3
Joined: Wed Jul 11, 2007 5:44 pm

Re: Templating ... a simple guide

Post by geckzilla »

edit: I ended up putting my own <!-- URLENCODE whatevervar --> into the template functions. Somehow I think this will bite me in the ass later. :lol:

Hi, I have an odd question... might there be any way to, say, do something like this:

<!-- URLENCODE -->{SOME_PHPBB_VARIABLE}<!-- ENDURLENCODE -->

A friend and I are creating some wild template which uses some flash elements and all has gone well up until the point where I want to send some PHPBB variables to the swf via the query string. In cases such as when things like ?f=22&t=1481are included in the variable I'm sending through the query string, it interprets that & as being the start of a new variable rather than part of the variable itself and is truly a nightmare to think about working around.

I don't mind modding the board software to achieve this though I really would like to avoid it. I kind of doubt what I want is already built in. I thought the <!--PHP--> tags would be a godsend but as it turns out you can't include phpbb variables within the php tags.

Any ideas?

Luk4ward
Registered User
Posts: 2
Joined: Wed Mar 05, 2008 6:26 am

Re: Templating ... a simple guide

Post by Luk4ward »

Highway of Life wrote:Try adding...

Code: Select all

'USER_RANK'                => ($user->data['user_rank']) ? $user->data['user_rank'] : '',  
to the functions file.
Hi

im trying to add on my header a profile menu with the avatar so i tried the avatar mod on index and using your advice i added into functions before line:

Code: Select all

if (!$online_userlist)
		{
			$online_userlist = $user->lang['NO_ONLINE_USERS'];
		}
the code:

Code: Select all

		// Avatar on Index and Default Avatar for Guest MOD --Version 2 Beta
    $avatar_img = $user_avatar_size = $user_avatar_thumb = $size = '';
    if ($user->data['user_avatar'] && $user->optionget('viewavatars'))
    {
       switch ($user->data['user_avatar_type'])
       {
          case AVATAR_UPLOAD:
             $avatar_img = $phpbb_root_path . "download.$phpEx?avatar=";
          break;

          case AVATAR_GALLERY:
             $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
          break;
       }
          $avatar_img .= $user->data['user_avatar'];
          $avatar_width = $user->data['user_avatar_width'];
          $avatar_height = $user->data['user_avatar_height'];

          $user_avatar_thumb = '<img src="' . $avatar_img . '" style="' . $size . '" alt="" />';
          $avatar_img = '<img src="' . $avatar_img . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="" />';
       }
//  Avatar on Index and Default Avatar for Guest MOD --Version 2 Beta
and before:

Code: Select all

'S_USERNAME'			=> $user->data['username'],
the code:

Code: Select all

// avatar mod
		'USER_AVATAR'   => ( $user->data['user_avatar'] ) ? get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']) : '',
                'USER_AVATAR_THUMB' => ( $user->data['user_avatar']) ? get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], ( $user->data['user_avatar_width'] > $user->data['user_avatar_height']) ? 60 : (60 / $user->data['user_avatar_height']) * $user->data['user_avatar_width'], ( $user->data['user_avatar_height'] > $user->data['user_avatar_width']) ? 60 : (60 / $user->data['user_avatar_width']) * $user->data['user_avatar_height']) : '',           		
                // avatar mod
and it is not working....Please help, thx in advance

TheBrandon
Registered User
Posts: 3
Joined: Sat Apr 12, 2008 11:53 pm

Re: Templating ... a simple guide

Post by TheBrandon »

Wonderful Guide.

Most of it I knew, but its easy to follow for those who do not. :mrgreen:
Image

Ethrel
Registered User
Posts: 2
Joined: Fri May 16, 2008 6:26 am

Re: Templating ... a simple guide

Post by Ethrel »

OK. I have no idea where else to turn, so I am turning here. I hope this is the correct place, otherwise please direct me!

OK. So, I am trying to build a module for the ACP. Through the documentation and looking through the modules already there I have figured out how things are supposed to be, but it is still not working. Makes me think that I am doing something wrong.

When I go to the module I created in the ACP, it displays everything. There is the problem, the if-then-else block logic is not being executed on the template, meaning the sections for everything are displayed. Is there some special setting somewhere to allow it, or do I need some variable or something? Nothing I seem to do works. If I view the page source, the comments with block logic are still on the page, whereas they do not show in the source when I view the other modules. Again, my only guess is that for some reason the template file is not running through whatever parsing it runs through to get the block logic.

The most confusing part of it all is the fact that the variables I set in $template->assign_vars ARE parsed (they show up), yet the block logic isn't?

EDIT3: In the interest of length, I have removed the code. Saves some length while reading this sh**.
Last edited by Ethrel on Sat May 17, 2008 3:06 am, edited 1 time in total.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: Templating ... a simple guide

Post by EXreaction »

You don't split those up on to 3 lines. It has to be exactly like shown in the first post,

<!-- IF () -->A<!-- ELSE -->
B
<!-- ENDIF -->

You can not put the <!-- IF --> or <!-- ELSE -->, etc on multiple lines.

Post Reply