Skip to:
Content
Pages
Categories
Search
Top
Bottom

how the bbpress’s front page controller works?


  • hywl51
    Member

    @hywl51

    hi,

    I installed a bbpress with the wordpress integration. But when I access one topic like:

    http://localhost/wordpress/bbpress/topic/1?replies=1

    the browser display:

    404 Not Found

    The requested URL /bbpress/topic/1?replies=1 does not exist.

    I don’t know how the bbpress front page works, so I cann’t find the real page the url above specify. Can someone give me some guids or any document about it. I browered and searched this site and found nothing about it.

    Thanks

    hywl51

Viewing 6 replies - 1 through 6 (of 6 total)

  • Atsutane
    Member

    @atsutane

    Most likely you forgot to set pretty permalink. https://bbpress.org/documentation/faq/#pretty-permalinks


    hywl51
    Member

    @hywl51

    Thank Atsutane.

    I set pretty permalink and got bbpress working.

    I am a newbie for PHP and eager to know how the box work behind the page. Can you please give me some advice or link about the question I mentioned before–how the bbpress front page works?

    Thanks

    hywl51


    Atsutane
    Member

    @atsutane

    Actually i don’t know what do you mean by “how the bbpress front page works?” Do you mean the page structure or do you mean the url structure?


    hywl51
    Member

    @hywl51

    Hi Atsutane

    Let’s explain the question clearly:

    https://bbpress.org/forums/topic/242?replies=4

    For url above, I want to know which page that url will finally located on. I guess all request will be first directed to index.php, but how about the next step and which page on earth will be directed to display the main body of page.

    I am not native English, I don’t know if I have made the question clear.

    Thanks for you kind response.

    hywl51


    ear1grey
    Member

    @ear1grey

    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.

    ear1grey,

    Actually MultiViews looks for topic.php if it hasn’t found topic/, but otherwise you’re spot on.

    You can also use RewriteRules which forces the server to do the same thing ‘manually’.

    hywl51,

    When you request that URL, Apache’s MultiViews or RewriteRules (whichever you are using) loads topic.php. That file then prepares a bunch of data and displays it with my-templates/topic.php (If that file exists) or bb-templates/topic.php (otherwise).

    If you are familiar with the way WordPress works, it may not help much :) This is one area where WordPress and bbPress are quite different.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar