PDA

View Full Version : Including another HTM document before a forum topic


petemay
10-07-2001, 03:04 AM
Hello,

Has anyone modified vB to insert HTM documents within a forum topic?

I would like to have a 'documentation' section on my web site with a table of documents for the user to chose from. I was planning on using a vB 'forum' page for the document index.

When a user selects a document (actually a vB topic) from the page, I would like the document to appear at the top of the page and then at the bottom a forum topic would be available for the user to post comments or questions about the document. I would like BOTH to appear on one page. I slapped something together with a Snitz forum that appears to work. I simply name the .htm file I want to include in the forum topic with the forum topic id. (i.e. 8.htm), then I have some code in the topic-display page that looks for that file in a directory and includes it.

The format is something like this:

Top of page:
------------------------------------
This document tells you everything you want to know about dirt.
1. dirt gets things dirty
2. dirt is tough to get out of your shirt.
3. I like dirt
------------------------------------
What do you think about dirt?:
<forum topic appears here>
-post1
-post2
-post3
------------------------------------
bottom of page

Can this type of thing be easily done with vB? I'm considering a purchase of vB to replace the Snitz forum.

Thanks,
PM

merk
10-07-2001, 06:34 AM
If i understand you correctly, this isnt too hard, using PHPs output buffering functions inside the 'PHPinclude' template

petemay
10-18-2001, 03:53 AM
Would you be able to provide some sample code that uses PHP's buffering functions? Are those types of functions already used somewhere in vBulletin? I am brand-spankin'-new to this php stuff. I'm not afraid to dig into it a bit - I'm just looking for some direction. Any manual pages you can point me to?

I'm trying to figure out the logic of the vBullitin processing. I see that the 'showthread.php' process is the one that displays the page, and the 'makenavbar' function apparently displays the top navigation bar. I would suspect that I would need to update the 'showthread.php' somewhere around there to insert the HTML from the other page....

Thanks for the response Merk! Now I need to find out why I didn't get an email from vBulletin when you updated my thread....

petemay
10-18-2001, 05:03 AM
Ok,

I did some experimenting and have made some progress... but I just need a wee bit of help now:

I updated the showthread.php, and added the following to the bottom:


// get htm file to include at the top of the thread:
ob_start();
require("../fielddoc/1/1.htm");
$fieldnote = ob_get_contents();
ob_end_clean();

eval("dooutput(\"".gettemplate("showthread")."\");");



Then I updated the showthread template to include a reference to:

$fieldnote

just after the $header - this test works great!. however....

I would like the '.htm' file to be dynamic. The name of the .htm file should match the thread id.... so the 'require' command would need to be updated to reference the threadid variable. something like:

require("../fielddoc/1/" $threadid ".htm");

.. as I said I'm really wet behind the ears on this php stuff. What would the correct syntax for that command be? Any suggestions for an on-line guide to basic php?


:D

merk
10-20-2001, 11:41 AM
This isnt too hard, and i hope im not too late replying, been out of action for quite a while.

its simple>



require("../fielddoc/1/".$threadid.".htm");



The . indicate basically a +.

That should solve your problem

petemay
10-25-2001, 04:06 PM
Right on. That looks like it did it!

Thanks for the reply Merk!

Can you recommend any good php Tutorial web sites, so I can get myself up to speed on this stuff?

Thanks!

merk
10-26-2001, 05:20 AM
Originally posted by petemay
Right on. That looks like it did it!

Thanks for the reply Merk!

Can you recommend any good php Tutorial web sites, so I can get myself up to speed on this stuff?

Thanks!

Not really -

I dont really like the tutorial websites, and im more of a 'book' person.

I can recomend, 'Core PHP Programming Edition 2' It has a purple spine.

A very wonderful book.

Someone else may be able to help you with some tutorial websites however! :)

Palmer ofShinra
10-26-2001, 10:05 PM
<a href="http://www.php.net/manual/en" target="_blank">http://www.php.net/manual/en</a>

The official PHP Manual online...

Not much of a tutorial, I'm afraid... but it's good when you need to learn the application of specific functions to do things.

I've used it a lot lately.

feldon23
11-03-2001, 03:54 PM
Maybe I'm missing the point, but couldn't you just add questions to the FAQ? I know it would turn it into a "your FAQ" + "vB FAQ" but still...