Skip to:

Re: how the bbpress’s front page controller works?

You’ll have noticed that there’s no “topic” subdirectory inside your “forums” directory, so what I think you’re asking is “is bbPress really serving a page that doesn’t physically exist on my hard drive?”

The answer is yes, bbPress generates the page on the fly, so there is no stored page that has the content of that URL.

Apache’s MultiViews option makes this happen because the server tries to find the best match to your URL. It looks first for forums and finds it, so then it looks for topic in forums, which doesn’t exist, so it tries the next best thing, which is to look for an index of some kind, and it finds the bbPress index.php.

When bbPress runs (through index.php) it still sees the originally requested url, so the fact that it’s a request for topic/242 is spotted by the code – it’s a simple as stripping the integer value from the string and using that as the primary key for the database lookup.

Briefly, the sequence is that index.php loads bb-load.php, bb-load.php loads your config.php, which specifies where your DB is (so the content can be generated), config.php then loads bb-settings.php which is where most of the core request-processing is done.

At least… that’s what I got from looking through the code :) A core dev. might be able to describe it better.

Skip to toolbar