[FAQ] Editing headers and footers

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

[FAQ] Editing headers and footers

Post by Black Fluffy Lion » Sat Apr 06, 2002 10:46 am

New link to the Knowledge Base

Handy Dandy Guides Present...

FAQ on editing headers and footers!

Contents
  • Introduction
    • I looked in the admin panel but there's no option to change headers/footers/meta values. How can I put these in?
    • Whoah! I'm lost already! How do these template thingies work then?
    • So where do I find these great 'templates'?
    • I don't have a script editor. How do I open them?
    • What the...? I don't get any of that complicated PHP stuff! Care to explain?
  • Editing headers and footers
    • I want to edit my header. Where do I start?
      • Can I change my meta values?
      • How do I replace the phpBB2 logo with my own?
      • How do I put text or images into my header?
      • How can I add a link to the 'FAQ', 'Search', 'Memberlist' ... 'Logout' links?
      • How do I change the width of phpBB2's table?
    • OK, I'm done with my header, now what about the footer?
  • Index page editing
    • I've seen at some fora they have a header that only appears on the index page. How do I do that?
    • Ahah! So that's how people move around the login and who's online boxes, is it?
      • So how do I move the who's online box?
      • And what about moving the login box too?
  • Other (slightly) related things
    • Can I have php executables in the template files?
        • I saw a mod to do this. Does is work?
        • But I have the php BB code mod installed too. Can I still have php in my templates?
        • ARGH! That didn't work either. Is here any other way?
    • Can I get back that page loading and debugging info thing into my page like there was in the RCs?
    • I'm done on all my headers and footers and am now a guru at template editing. How can I edit even more?
    • I've edited all the files. Now I need them to actually display on my fora. How do I do that?
  • End note
Introduction

Do you dream of editing your fora's footer?? Do you constantly ponder over the existance of overall_header.tpl?? Do you lose sleep over wondering how to reposition the login box?? Then read on, into the exciting world of header editing!

I looked in the admin panel but there's no option to change headers/footers/meta values. How can I put these in?

First thing first. Many of you intelligent folk coming from phpBB may have noticed that there is no header/footer/meta section under the admin panel. That is becuase headers are done in a different way in phpBB2. That information is now stored in templates making it much more flexible and customizable and much more easy to edit.

Whoah! I'm lost already! How do these template thingies work then?

When you view a page of your fora the templates get loaded: First, overall_header.tpl is loaded. This displays all the information it's meant to and leaves <html>, <body> and the main phpBB table open. Then the correct main page template is loaded depending on where you are in the fora (e.g. if you're on the index page then index_body.tpl). Once it's done loading that it calls up overall_footer.tpl. This closes the table and <body> and <html>. To end the document page_tail.php gets loaded. This displays the debugging and page loading time information (if enabled).

So where do I find these great 'templates'?

Look in /templates/subSilver (thoroughout the FAQ I will be using subSilver, the default template. If you are using a different template then change the folder you look in accordingly). You will see a collection of files there. The templates are the ones with the file extension '.tpl' The majority of files in that folder are .tpl files.

I don't have a script editor. How do I open them?

You don't need some fancy code editor to edit them, any old text editor will do. On my computer, the tpl files open up in Word. That's fine and it works perfectly. Note that if you use something like Word you will need to open and save the tpls as plain text, not as a web page. You need to use Word as a text editor rather than a WYSIWYG (What You See Is What You Get) editor. On a related note, do not use WYSIWYG editors to edit templates. This means don't use anything where the tpl file appears as it will look like in a browser rather than in plain HTML text (e.g. Frontpage). Using a WYSIWYG editor will tack on useless bits of code to the page and may remove vital parts. Generally, it messes things up in tpl files, you want to edit it as plain text. Although I use Word (becuase I can't be bothered to change it) I recommend you use Notepad to edit the tpls. Open up a template and have a look inside.

What the...? I don't get any of that complicated PHP stuff! Care to explain?

These templates are written in simple HTML, you need absolutely no PHP knowledge whatsoever to edit them, though as they are written in HTML it might be useful to go learn the basics of that if you don't already know it.

Editing headers and footers

I want to edit my header. Where do I start?

Well, that depends on what you want done. So I'll split this bit up into multiple sections...

Can I change my meta values?

Yes! Open overall_header.tpl (remember I told you how to do this). At the top of the file you will see this:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
<meta http-equiv="Content-Style-Type" content="text/css">
Just bung your meta values in there! You can put them anywhere in the head of the document, but I like to put mine in at the top. Here's what the metas at the top of my overall_header.tpl look like:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}">
<head>

<meta name="description" content="Gamecatcher is a site dedicated to strategy-gaming in general, trying to get all the information you may want about the strategy gaming world. It also has excellent strategy gaming forums where you can discuss computer games with other fans." />
<meta name="keywords" content="gamecatcher, center, game center, game catcher, civilization, civ, real-time strategy, game, forum, fora, forums, sid meier, spycatcher, gaming, discussion, age of empire, starcraft, empire earth, europa universalis, warcraft, turn-based strategy game, strategy, sim, simcity, the sims, will wright, colonization, SMAC, alpha centauri" />
How do I replace the phpBB2 logo with my own?

Aaah, that old demon which seems to be continually popping up around the support forum. "But am I actually allowed to change the logo to my own?" I hear you say. Yes you are. There is nothing wrong with changing the default subSilver logo. And there are 2 ways to do so.

The first way is by changing the path of the logo. Upload your logo to templates/subSilver/images and call it logo.gif or something like that. Then, look (near the end of the document) for:

Code: Select all

<td><a href="{U_INDEX}"><img src="[color=red]templates/subSilver/images/logo_phpBB.gif[/color]" border="0" alt="{L_INDEX}" vspace="1" /></a></td>
Simply change the bit highlighted in red to the path of your own logo. Easy or what??

The second way to change the logo is even easier. Just overwrite logo_phpbb.gif with your own logo and upload it to templates/subSilver/images and call it logo_phpbb.gif. Couldn't be easier!

How do I put text or images into my header?

Right, now we're getting on to the meaty bits of header editing. Do a search in overall_header.tpl for

Code: Select all

<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">

<a name="top"></a>

<table width="100%" cellspacing="0" cellpadding="10" border="0" align="center"> 
	<tr> 
		<td class="bodyline"><table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tr> 
This is where the table for phpBB2 is opened. I like my header to appear above the edge of the table so my overall_header.tpl has been edited to look like this (edited bit highlighted in red):

Code: Select all

<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">

<a name="top"></a>

[color=red]<div align="center"><p>Members of <a href="http://www.civgaming.net" target="_blank"><b><font size=+1>Civilization Gaming Network</a></p> </font></b></div>
<p align="center"> <img
src="http://www.civgaming.net/gamecatcher/phpBB2/images/smiles/mwaha.gif"
width="15" height="16"><a href="http://freechat.raidersoft.com/sigmachat.pl?room=10549" target="_blank"><b>CHAT OR DIE. RESISTANCE IS FUTILE. YOU WILL CHAT. MWHAHAHAHAHAHAHA</a><img
src="http://www.civgaming.net/gamecatcher/phpBB2/images/smiles/mwaha.gif"
width="15" height="16"></p></b></p>
<div align="center"><p><a href=http://www.civgaming.net/gamecatcher/ target="_blank"><b><font size=+1>Gamecatcher Center</a></p> </font></b></div>[/color]

<table width="100%" cellspacing="0" cellpadding="10" border="0" align="center"> 
	<tr> 
		<td class="bodyline"><table width="100%" cellspacing="0" cellpadding="0" border="0">
...and it comes out like so.

If you wanted your header to come out within the table, as some people do, then just put it below the

Code: Select all

<table width="100%" cellspacing="0" cellpadding="10" border="0" align="center"> 
	<tr> 
		<td class="bodyline"><table width="100%" cellspacing="0" cellpadding="0" border="0">
How can I add a link to the 'FAQ', 'Search', 'Memberlist' ... 'Logout' links?

Open overall_header.tpl and search for

Code: Select all

td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span><span class="mainmenu">& &<a href="{U_SEARCH}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" />{L_SEARCH}</a>& &<a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>& &<a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a>& 
						<!-- BEGIN switch_user_logged_out -->
						&<a href="{U_REGISTER}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_register.gif" width="12" height="13" border="0" alt="{L_REGISTER}" hspace="3" />{L_REGISTER}</a></span>&
						<!-- END switch_user_logged_out -->
						</td>
					</tr>
					<tr>
						<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>& &<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>& &<a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a>&</span></td>
That's where the links are in the header. Just insert your own! For example, a link to go back to the homepage (edited code highlighted in red):

Code: Select all

td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span><span class="mainmenu">& &<a href="{U_SEARCH}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" />{L_SEARCH}</a>& &[color=red]<a href="http://www.myhomepage.com" class="mainmenu">Homepage</a>& &[/color]<a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>& &<a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a>& 
						<!-- BEGIN switch_user_logged_out -->
						&<a href="{U_REGISTER}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_register.gif" width="12" height="13" border="0" alt="{L_REGISTER}" hspace="3" />{L_REGISTER}</a></span>&
						<!-- END switch_user_logged_out -->
						</td>
					</tr>
					<tr>
						<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>& &<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>& &<a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a>&</span></td>
How do I change the width of phpBB2's table?

Open overall_header.tpl and search for:

Code: Select all

<table width="[color=red]100%[/color]" cellspacing="0" cellpadding="10" border="0" align="center"> 
	<tr> 
Then change the part highlighted. You can do this as a percentage e.g:

Code: Select all

<table width="[color=red]75%[/color]" cellspacing="0" cellpadding="10" border="0" align="center"> 
	<tr> 
...or if you prefer you can state the table width in pixels:

Code: Select all

<table width="[color=red]900[/color]" cellspacing="0" cellpadding="10" border="0" align="center"> 
	<tr> 
OK, I'm done with my header, now what about the footer?

Editing the footer involves using the same basic principles, so I won't describe how to do it so fully here. Just open overall_footer.tpl this time. Looks a bit empty in comparison to overall_header.tpl doesn't it?? All that's on there is the copyright notice, linking back to phpBB.com (WHICH YOU MUST RETAIN) and the link to the admin panel. Just edit that file like you did overall_header.tpl

Index page editing

I've seen at some fora they have a header that only appears on the index page. How do I do that?

This too follows the same basic principles of editing the footer and header. The template for the index is a file called index_body.tpl, which is located in templates/subSilver, with the rest of them. Editing it is just like editing the header and footer, no new explantion needed.

Ahah! So that's how people move around the login and who's online boxes, is it?

It is indeed. Both the login and who's online boxes are displayed through code in index_body.tpl.

So how do I move the who's online box?

To move around the who's online box open up index_body.tpl and do a search for

Code: Select all

<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline"> 
<tr> 
<td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="{U_VIEWONLINE}" class="cattitle">{L_WHO_IS_ONLINE}</a></span></td> 
</tr> 
<tr> 
<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td> 
<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span> 
</td> 
</tr> 
<tr> 
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} & [ {L_WHOSONLINE_ADMIN} ] & [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td> 
</tr> 
</table> 

<table width="100%" cellpadding="1" cellspacing="1" border="0"> 
<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td> 
</table> 
That's what displays the who's online box. If you want to move it to the top of the page then just paste it after

Code: Select all

 
<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center"> 
<tr> 
<td align="left" valign="bottom"><span class="gensmall"> 
<!-- BEGIN switch_user_logged_in --> 
{LAST_VISIT_DATE}<br /> 
<!-- END switch_user_logged_in --> 
{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td> 
<td align="right" valign="bottom" class="gensmall"> 
<!-- BEGIN switch_user_logged_in --> 
<a href="{U_SEARCH_NEW}" class="gensmall">{L_SEARCH_NEW}</a><br /><a href="{U_SEARCH_SELF}" class="gensmall">{L_SEARCH_SELF}</a><br /> 
<!-- END switch_user_logged_in --> 
<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td> 
</tr> 
</table> 
And what about moving the login box too?

You want to move that to the top of the page too?? OK, keep index_body.tpl open and search for

Code: Select all

<!-- BEGIN switch_user_logged_out --> 
<form method="post" action="{S_LOGIN_ACTION}"> 
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline"> 
<tr> 
<td class="catHead" height="28"><a name="login"></a><span class="cattitle">{L_LOGIN_LOGOUT}</span></td> 
</tr> 
<tr> 
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">{L_USERNAME}: 
<input class="post" type="text" name="username" size="10" /> 
&&&{L_PASSWORD}: 
<input class="post" type="password" name="password" size="10" /> 
&& &&{L_AUTO_LOGIN} 
<input class="text" type="checkbox" name="autologin" /> 
&&& 
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" /> 
</span> </td> 
</tr> 
</table> 
</form> 
<!-- END switch_user_logged_out --> 
...then paste it after your newly moved who's online box! Or if you haven't moved that then below the code I told you to put the who's online box below.

Other (slightly) related things

Can I have php executables in the template files?

phpBB does not parse any php inserted into templates automatically so, in short: 'no'. It's easier if you just try to get another way to do what you wanted (e.g. JavaScript instead of php for an ad rotations system). However, if php is the only way then there are a few of workarounds:

I saw a mod to do this. Should I use that?

Yes. You can download it from here. Unfortunately it does not work if you do have the phpBB code mod installed too.

But I have the php BB code mod installed too. Can I still have php in my templates?

Yes you can. Open page_header.php and at the top add:

Code: Select all

ob_start();
include("<your_header_path>");
$my_header = ob_get_contents();
ob_end_clean();

ob_start();
include("<your_footer_path>");
$my_footer = ob_get_contents();
ob_end_clean();
In the same file at the end of template->assignvars list (around line 420 or so) add:

Code: Select all

	"MY_HEADER" => $my_header,
	"MY_FOOTER" => $my_footer
In overall_header.tpl and overall_footer.tpl add this code where you want your header or footer to appear:

Code: Select all

{MY_HEADER}
{MY_FOOTER}
ta-da! Works perfectly, doesn't it?? No?! Well, you're not beyond help yet...

ARGH! That didn't work either. Is here any other way?

There is. Here we go: open /includes/page_header.php and find

Code: Select all

header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0'); 
header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); 
header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 

$template->pparse('overall_header'); 
In between the last header but before the template parse insert

Code: Select all

// Start Banner Code 
ob_start(); 
require("foo"); 
$banner = ob_get_contents(); 
ob_end_clean(); 
$template->assign_vars(array('BANNER' => $banner)); 
// End banner code 
...so it looks like this (edited bit highlighted):

Code: Select all

header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0'); 
header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); 
header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 

[color=red]// Start Banner Code 
ob_start(); 
require("foo"); 
$banner = ob_get_contents(); 
ob_end_clean(); 
$template->assign_vars(array('BANNER' => $banner)); 
// End banner code [/color]

$template->pparse('overall_header'); 
Now open up the tpl file you want the code appearing in and insert

Code: Select all

{BANNER}
...where you want the code to appear.

Can I get back that page loading and debugging info thing into my page like there was in the RCs?

Of course you can! Although it was intended to only be used during development and not included with the final release you can easily put it back again. Here's how:

Open extension.inc (in phpBB2's base directory) and find

Code: Select all

$starttime = 0;
Replace this with

Code: Select all

// 
// For debug timing 
// 
$mtime = microtime(); 
$mtime = explode(' ',$mtime); 
$mtime = $mtime[1] + $mtime[0]; 
$starttime = $mtime;
Then open up includes/page_tail.php (remember, this is the file that gets called up last when loading a phpBB2 page) and find

Code: Select all

// 
// Close our DB connection. 
// 
$db->sql_close(); 

// 
// Compress buffered output if required and send to browser 
//
...and replace it with

Code: Select all

// 
// Close our DB connection. 
// 
$db->sql_close(); 

// 
// Output page creation time 
// 
$mtime = microtime(); 
$mtime = explode(' ',$mtime); 
$mtime = $mtime[1] + $mtime[0]; 
$endtime = $mtime; 
$totaltime = ($endtime - $starttime); 

$gzip_text = ($board_config['gzip_compress']) ? "GZIP compression enabled" : "GZIP compression disabled"; 
$debug_mode = (DEBUG) ? " : Debug Mode" : ""; 

printf("<br /><center><font size=\"-2\">phpBB Created this page in %f seconds : " . $db->num_queries . " queries executed : $gzip_text".$debug_mode."</font></center>", $totaltime); 

// 
// Compress buffered output if required and send to browser 
//
Done!

I'm done on all my headers and footers and am now a guru at template editing. How can I edit even more?

Editing of headers and footers not enough for you then, eh?? You want to be able to change more aspects of your fora?? Well I won't go into that fully here since I'm starting to ramble off topic and the mods'll shoot me but the best advice I can give for editing of more templates is 'Use yer brain!' If you want to change the way the page looks inside a forum then what file do you edit?? Well if you look through the templates folder it's pretty obvious. To edit how a forum is viewed edit viewforum_body.tpl. All the names of the files are self explanitory so don't be an idiot and prat around with faq_body.tpl trying to look for the layout of the member list. The possibilities are endless towards how customized your fora can be. The only limit is your imagination.

I've edited all the files. Now I need them to actually display on my fora. How do I do that?

Before changing anything I advise you to make a backup of the files you are changing. I do this by keeping my original phpBB2 files in one folder and keeping my edited phpBB2 files in another. So, before uploading, make a copy of the original tpl files. Then, just upload the changed files into templates/subSilver and it'll work perfectly!

End note

Well, that's all, hope you found the tutorial useful. Might I suggest that if you have a question regarding header editing or about this FAQ you post about it here rather than PMing me about it. That way, there is more chance you will be helped, and faster, though I will try to answer any PMs I get on the subject. This tutorial would not have been possible without a few people's help, which I thank them greatly for: DEHiCKA, james_hayward100, Matthijs and Ryan McLaughlin for their work on inserting php into templates; Bear, for sticking this thread; Brewjah, for his excellent tutorial on moving the who's online and login boxes; psoTFX for suppyling the code to enable page loading times and debugging info; the rest of the phpBB2 team for making such a great bit of software; and lastly, to you, for reading it.

May you edit headers - in index pages or in forum categories; in memberlists or in FAQs; in who's online or in login boxes - for ever more.

keywords: header edit footer meta edit button change logo template php insert rotation code banner table size change width who's online box who is login move debug button top move parse buttons information page loading time
Last edited by Black Fluffy Lion on Sun Sep 01, 2002 9:08 am, edited 18 times in total.

Joey Gambino
Registered User
Posts: 140
Joined: Fri Apr 05, 2002 4:07 pm
Location: Boston
Contact:

Post by Joey Gambino » Tue Apr 09, 2002 3:41 pm

Ok...what I'm looking to do is add a link directly in the list of links at the top.

Like so:

FAQ Search Memberlist Usergroups Register My New Link
Profile My New Link 2 You have no new messages Logout [ Joey Gambino ]

Can this be done? I don't see anywhere in your faq that it's shown...

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion » Tue Apr 09, 2002 3:45 pm

look in overall_header.tpl and search for

Code: Select all

td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span><span class="mainmenu">&nbsp; &nbsp;<a href="{U_SEARCH}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" />{L_SEARCH}</a>&nbsp; &nbsp;<a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>&nbsp; &nbsp;<a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a>&nbsp; 
						<!-- BEGIN switch_user_logged_out -->
						&nbsp;<a href="{U_REGISTER}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_register.gif" width="12" height="13" border="0" alt="{L_REGISTER}" hspace="3" />{L_REGISTER}</a></span>&nbsp;
						<!-- END switch_user_logged_out -->
						</td>
					</tr>
					<tr>
						<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>&nbsp; &nbsp;<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>&nbsp; &nbsp;<a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a>&nbsp;</span></td>
and just add in your own! :)

Joey Gambino
Registered User
Posts: 140
Joined: Fri Apr 05, 2002 4:07 pm
Location: Boston
Contact:

Post by Joey Gambino » Tue Apr 09, 2002 3:57 pm

I love you.

What confused me was that there was no actual URL links.

Thank you Thank you Thank you.

User avatar
serre
Registered User
Posts: 9
Joined: Tue Apr 09, 2002 4:09 pm
Contact:

php

Post by serre » Tue Apr 09, 2002 4:14 pm

Is it possible to use php-code in de header and footer files? and how?

GS

Kail
Former Team Member
Posts: 4924
Joined: Mon Oct 22, 2001 9:57 pm
Location: Sweden
Contact:

Post by Kail » Tue Apr 09, 2002 4:20 pm

You have to write the PHP code in the PHP-files. Please try to search for a more extensive answer as this question has already been answered several times before.

Jakob Persson - Style Designer, Freelance Web Designer, Usability Consultant and Developer | BLOG | PORTFOLIO
My Complete phpBB Template Design Guide
Creator of Chronicles, SpacePilot3K (updated!), Solaris, Cobalt 2.0 and JustFooty.
Image phpbb-se.com - phpBB på svenska!

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Re: php

Post by Black Fluffy Lion » Tue Apr 09, 2002 4:22 pm

serre wrote: Is it possible to use php-code in de header and footer files? and how?

GS


there were a few issues in inserting PHP into tpls, but I think they were fixable. Try searching for the mods forum for that...it's best to just use javascript

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion » Tue Apr 09, 2002 4:44 pm

here's a little workaround I found (by DEHiCKA):

Here how I'm include my php headers:

In page_header.php on top of the code add:

Code: Select all

ob_start();
include(<your_header_path>");
$my_header = ob_get_contents();
ob_end_clean();

ob_start();
include("<your_footer_path>");
$my_footer = ob_get_contents();
ob_end_clean();
In the same file at the and of teplate->assignvars list (around line 420 or so) add:

Code: Select all

	"MY_HEADER" => $my_header,
	"MY_FOOTER" => $my_footer
In overall header.tpl & overall footer.tpl add in place where your header & footer appears:

Code: Select all

{MY_HEADER}
{MY_FOOTER}
And vuala, my header & footer I used in other pages of my site works well in the forum.
As U can see: http://gal.ttk.ru (sorry it's in russian, forum is the last button in the top menu)

so, it's a bit of work since phpBB doesn't parse php in templates. as I said, your best bet is to try and use something else, like javascript.

I'll add it to the FAQ later...

sara_dippity
Registered User
Posts: 45
Joined: Fri Apr 05, 2002 10:35 am
Location: Oklahoma, "Land of Dull"

Post by sara_dippity » Tue Apr 09, 2002 8:26 pm

Are the 2 lovely posts in yer sig going to be archived?

Bear
Registered User
Posts: 2586
Joined: Mon Dec 31, 2001 7:50 pm
Location: 127.0.0.1
Contact:

Post by Bear » Tue Apr 09, 2002 8:29 pm

I would certainly like to use them for the FAQ.
Bear
Got a thing for fashion? So do we at the Fashion Spot.
Let us give you the Royal Treatment at Les Tribunes Royales.

whofarted
Registered User
Posts: 387
Joined: Tue Apr 09, 2002 8:19 am
Location: Lost, If found return to St.Louis, MO

Post by whofarted » Wed Apr 10, 2002 7:38 am

Thanks for taking the time to show this. I've been dying to know how to do this with php files. I'm still a php/mysql newbie so I learn by trial and error. Mostly error :roll:

One more thing, is there a way to get it to use my header/footer onlyon the index (forum list) page?

Thanks again. :wink:
you smell something? :)

R45
Registered User
Posts: 2830
Joined: Tue Nov 27, 2001 10:42 pm

Post by R45 » Wed Apr 10, 2002 9:16 am

Overall_header and footer, as the name suggests, appear on ALL forums. If you want to customise a header for a specific page, you'll need to edit the corresponding php file, and include the template file or you don't really need to use the template system, just include the file within the php file. So it would probably mean editing index.php, taking out overall_header from including and include your custom header.

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion » Wed Apr 10, 2002 11:53 am

whofarted wrote: Thanks for taking the time to show this. I've been dying to know how to do this with php files. I'm still a php/mysql newbie so I learn by trial and error. Mostly error :roll:

One more thing, is there a way to get it to use my header/footer onlyon the index (forum list) page?

Thanks again. :wink:


inserting headers and footers that apear only on the index page is explained under 'I've seen at some fora they have a header that only appears on the index page. How do I do that?'

thanks for the positive feeback all :D feel free to put them in any FAQ or guide you want.

Bear
Registered User
Posts: 2586
Joined: Mon Dec 31, 2001 7:50 pm
Location: 127.0.0.1
Contact:

Post by Bear » Wed Apr 10, 2002 11:57 am

I'll stick this until the FAQ's are put together.
Bear
Got a thing for fashion? So do we at the Fashion Spot.
Let us give you the Royal Treatment at Les Tribunes Royales.

Bear
Registered User
Posts: 2586
Joined: Mon Dec 31, 2001 7:50 pm
Location: 127.0.0.1
Contact:

Post by Bear » Wed Apr 10, 2002 12:09 pm

Since your mod is also an edit to the header, I will include your link here. Consider this as stuck. :wink:

[Tutorial] How To Change The Default phpBB Logo
Bear
Got a thing for fashion? So do we at the Fashion Spot.
Let us give you the Royal Treatment at Les Tribunes Royales.

Locked

Return to “2.0.x Support Forum”