1

Topic: Edit Header.php to integrate PunBB in site layout

To integrate PunBB into my site I need to be able to replace elements of the header with my own layout elements, but header.php is an impenetrable bunch of php code and any edit I try to make causes fatal errors.

How can I add my own code (html, javascript, php includes) to the <head> part?
How can I insert my own layout right after the <body> tag? (That looks particularly impossible. The body tag and everything that follows is all merged together in the same bunch of code)

I'm actually really annoyed by this. I thought PunBB was supposed to be lightweight, unobtrusive and easy to integrate, but the header seems designed to shut everything else out.

2

Re: Edit Header.php to integrate PunBB in site layout

Take a look at main.tpl instead of header.php.

3

Re: Edit Header.php to integrate PunBB in site layout

Thanks. That makes sense. But php includes don't work in this .tpl file. Any way around that?

4

Re: Edit Header.php to integrate PunBB in site layout

http://punbb.org/docs/faq.html#faq3_4

5

Re: Edit Header.php to integrate PunBB in site layout

Thanks again for the quick reply.

I'm trying to integrate PunBB into the rest of the site, so this weird include workaround is pointless if I have to put the files in PunBB's include/user/ folder.

The only "elegant" option seems to be to just copy the complete html into main.tpl and update it whenever I update the original elements I use in the rest of the site. Not ideal.

Re: Edit Header.php to integrate PunBB in site layout

As the doc doesn't suggest (but I thought it did), you can add shortcuts (I think they're called symlinks in Linux?) to the files within that folder. That way, the file doesn't actually have to be within the folder
The alternative is simply to make a script that includes or requires the script you actually need

7

Re: Edit Header.php to integrate PunBB in site layout

Just to clarify, does that mean the script in include/user can just be a minimal script which does nothing but include the header and footer files etc from their original locations?

Re: Edit Header.php to integrate PunBB in site layout

I haven't tested it, but that should be fine: there just needs to be a script that's in the folder. If it decides to call something else, I don't think PunBB can stop it wink

9

Re: Edit Header.php to integrate PunBB in site layout

It's a silly solution, but it works. Thanks! smile

10 (edited by Smartys 2006-01-11 00:48)

Re: Edit Header.php to integrate PunBB in site layout

It's better than allowing arbitrary code execution to be possible wink

http://dev.punbb.org/changeset/208

11 (edited by Peter 2006-01-12 18:07)

Re: Edit Header.php to integrate PunBB in site layout

It's still a real pain in the neck to integrate this into a site. main.tpl has this:

<html dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
<pun_head>
</head>

What does pun_content_direction do? Can I just replace <pun_head> so I can use my own style link and get rid of 'My PunBB Forum' in the title bar?

It's too hard to pick code and layout apart. The stylesheet situation also seems overcomplicated:

/* Import the basic setup styles */
@import url(imports/base.css);
/* Import the colour scheme */
@import url(imports/Oxygen_cs.css);

Can I make my own replacement stylesheet based on Oxygen + base + Oxygen_cs? Or are there even more bits and pieces hidden somewhere required to run PunBB?