1 (edited by freddykgb 2006-02-28 05:23)

Topic: Adding a header and a footer to punBB

- I'll have to add a header (title logo, a bar with a menu, 766px centered auto margin, code already written)
- And a footer (some site infos and links, 766px centered auto margin, code already written) tu punBB forum
Those header/footer will always stay visble whenever section of the fofums user will be browsing.

In fact, i'm looking to add a command like this somewhere to the forum code :

<?php include("http://www.url_site.com/inc/header.php"); ?>
<punBB FORUM CODE HERE>
<?php include("http://www.url_site.com/inc/footer.php"); ?>

Where (which files and where into these files) and how should I add this?

A new poker community is rising : see for yourselft at unbluffed.com

Re: Adding a header and a footer to punBB

I'll quote directly from the PunBB FAQ that's included in your download.

3.4 - Is it possible to include my own PHP scripts in the templates?
Yes. PunBB has a special replacement variable called pun_include for including scripts in the templates. For example, if you wanted to include a script called banner.php at the bottom of all forum pages, you would place the script in include/user/ and add the following to your template files:

<pun_include "banner.php">

The script banner.php must be located in the user include directory mentioned above. PunBB will execute the script and the pun_include variable will be replaced by any output that the script produces. Please note that all included scripts have access to the PunBB variables, so if you e.g. wanted to access the database, you could use the $db object just like the rest of PunBB does. Replacement of the pun_include variable is the last thing that PunBB does when it outputs a page, so you don't have to worry about not using variable names that PunBB uses.

Through the awful grace of God

"Dude, CSS and XHTML are like two boys who are deeply in love.  They're perfect for each other, but no one can acccept it."

Re: Adding a header and a footer to punBB

HUm...  thanks for answering but I am not sure you understand well my question.  big_smile

What I have is 2 separated html/php pages, and I want to place them before and after the forum content. IS it what you understood or am i just confused by your answer that overpass my php very light knowledge ?

A new poker community is rising : see for yourselft at unbluffed.com

Re: Adding a header and a footer to punBB

~sigh~

This is my 'main.tpl' file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
<link rel="shortcut icon" href="favicon.ico" />
<pun_head>
</head>
<body id="where-discussion">

<pun_include "csheader.php">

<div id="punwrap">
<div id="pun<pun_page>" class="pun">

<div id="brdheader" class="block">
    <div class="box">
        <pun_navlinks>
        <pun_status>
    </div>
</div>

<pun_announcement>

<pun_main>

<pun_footer>

</div>
</div>

<pun_include "csfooter.php">

</body>
</html>

See the <pun_include "csheader.php"> and <pun_include "csfooter.php">?  That's the include script.

The actual files themselves are located at /discussion/include/user/.

I don't get what you're saying...isn't that exactly what you want?

Through the awful grace of God

"Dude, CSS and XHTML are like two boys who are deeply in love.  They're perfect for each other, but no one can acccept it."

5 (edited by freddykgb 2006-03-05 20:48)

Re: Adding a header and a footer to punBB

Exactly! Thanks again big_smile

Can the files csfooter.php and csheader.php be located in another folder than the one you suggested (/discussion/include/user/)? 
Since those php files would be used for my main web site too.

A new poker community is rising : see for yourselft at unbluffed.com

Re: Adding a header and a footer to punBB

By using enough ../-es in your path I guess so.