That works, thank you.

I know that I can add markup to the <head> using a template, or by editing header.php.  But how would I add markup that appears in the <head>, only when a certain page is being used (for me, it's profile_fields.php from the Easy Profile Fields mod, but I guess this applies to any page)?

Sorry for asking such a n00bish question.

Thanks in advance.

Paul wrote:

Thinking about it, the problem is probably quite obvious. The problem is that <pun_include> is output last of all. By that time PunBB has already merged its output with the template and flushed the buffers. That would leave your function with nothing to work with. It seems to me the only way to get this to work is to add your function as the last item in footer.php and then run your function against $tpl_main (which is holding all the merged content).

Just tried your suggestion, and it worked like a charm!  Thank you so much for dealing with my n00b questions in such a helpful way.

Paul wrote:

My reading of the php manual is that where there is nesting then for each ob_start there must be an equal number of ob_end_clean or ob_end_flush. PunBB always uses ob_end_clean.

Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order.

Thanks for the reply.  Unfortunately, I'm not familiar enough with the coding of PunBB to know how to fix this.  Adding an ob_end_flush at the end of my template doesn't seem to fix it.  Any ideas on what PunBB files I should edit that would fix this?

Thanks in advance.

gog wrote:

Why would you convert everything to HTML? It is ok to send XHTML 1.0 as text. XHTML 1.1 is the one that should be send as application/xhtml+xml only...

a) I am using XHTML 1.1.
b) Even XHTML 1.0 can only be sent as text/html if it is in compatibility mode, which I do not use.
c) There is no point in using XHTML anyway if it can be sent with an HTML MIME type and still be read as intended, since then it is basically HTML with weird slashes and various validation errors.
d) I am considering using XForms with an XML Schema for XHTML 1.1 + XForms 1.0.  Since there is no DOCTYPE on that version, if I sent it to a browser as the HTML MIME type, IE would likely go into Quirks Mode, which is not what I want to happen.
d) That wasn't relevant to my question anyway; this could just as easily be about an ob_start that converted it to l33t sp33k, added white space to indent stuff, or anything else that an ob_start could do.

Anyone have an answer to my original question?

Thanks in advance.

Smartys wrote:

Could the fact that PunBB uses ob_start in certain situations have something to do with it?

Yeah, that could be it.  But the PHP documentation says that ob_start can be nested with no bad effects.  So if that is the problem, it's probably a bug in PunBB.  What kind of usage in PunBB would screw up an ob_start that has already been called?  And if that is the problem, how would I fix it?  Would it be as simple as adding an ob_end_flush somewhere?  If so, where would I add it?  Could the problem be caused by the fact that my ob_start doesn't have an ob_end_flush associated with it (it just ends at the end of the file)?

Sorry for being such a n00b and asking so many questions.  Thanks in advance.

On my forum, I serve my pages as XHTML with application/xhtml+xml to any browser that supports it based on the accept-type header.  For browsers that don't, I use an ob_start with a converter function to convert it to HTML, and send it as text/html.  I have tested the converter script with WordPress, so I know it works.  I use the include tag in the main template file to include the PHP script which converts the output.  Unfortunately, I am running into problems.  The MIME type is set correctly, and the DOCTYPE and <html> tag that it directly outputs are correct.  But everything that the ob_start is supposed to do never happens; the output is still XHTML (not HTML) when I use a browser that does not support XHTML.  This problem only occurs with PunBB; the exact same script works fine when added to a WordPress template.

Anyone have any ideas?  Is it necessary for me to post my converter script?

Thanks in advance.

elbekko wrote:

I made it so it only selects the 5 newest fields smile If you want to remove this, remove the LIMIT 5 part from the queries in viewtopic.php and profile.php smile

Ah, that would explain it.  See, I told you I was likely being n00bish; looks like I was right, lol.  Thanks a bunch for the quick reply.

And now, I have another question.  Is there a way to make one (but not all) of the profile fields be rendered as a <textarea> rather than an <input>?  I'd like to include a field for "short bio," and a <textarea> seems better suited to that.

Thanks in advance.

This looks really nice, but I'm having a problem.  I've successfully installed Easy Profile Fields 1.1.1 on PunBB 1.2.12, but for some reason, after I added the 5th field, it stopped working.  Now, I can add more fields, and they even show up in the Admin panel, but I can't see them in my profile.  They do appear in the MySQL database, but they just don't show up in my profile.  I'm probably doing something really n00bish, but maybe you could enlighten me on what I'm doing wrong?

Thanks in advance.