Skip to:

plugin idea: single page threads broken up by a divider…

  • That topic header sounds dumb but I’m wanting to have it on my bbpress forum that each topic has only one page, with say 30 posts shown. When there are more than 30 posts, the page divides in two and in between the two sections (each with 15 posts) there is a button or something that says ‘View Posts 15-74’ and when you click on that it loads up the rest of the comments in its place.

    Pretty much you can have a thread where you only have 30 posts shown, the first bunch and the most recent bunch and if you want to read all the other posts in between you just click on the divider bit in the middle.

    Example? Exactly like the topics on this forum:

    Hopefully someone else thinks that this is a great idea and would consider making a plugin or something. I’ve got no idea how hard it would be but I’d really, really like to see it and I would have no chance in coding it myself :(

Viewing 7 replies - 1 through 7 (of 7 total)
  • Someone else must want this!

    > I would have no chance in coding it myself :(

    Not if you’re thinking like that. Starting to code in PHP really isn’t so hard and there’s no genuinely nasty bits in this plugin.

    But even if you really don’t want to try doing it yourself, bumping it does no good at all. The forum isn’t active enough for this to disappear off the front page immediately and plenty of people will see. There’s also far more people with ideas than people who want to write plugins but have no ideas (and that’s the way I suspect it will always be), so plugin requests are a rather long shot.



    I don’t see that discussion forum doing what I think you’re asking for. I clicked a long thread (27 replies at the time) and it loaded all the comments on one page:

    Do you have an example of a page where what you want to happen is happening? Maybe I misunderstood or missed it.



    The trick would be doing it via ajax. Harder than it sounds.

    Especially considering that bbpress’s ajax library is in flux from what I understand.

    It’s easy to load the entire page including posts 15-74 and keep them hidden via css until clicked – this doesn’t even need a plugin – but the page load time and bloat, not to mention mysql load would be rather high.

    Chris: only above 40 posts or somesuch.

    From what I’ve heard, *press will probably end up with jQuery.

    _ck_, is the cost of fetching a fairly unlimited and variable number of posts significantly greater than the cost of fetching just 40 once? I always thought the cost of doing a query at all was the significant thing, not the amount of data you get back – but I’ve not systematically learned SQL and I don’t really know where or how to look for this information :/ Is there any place you can recommend?


    Typically the cost of doing a query at all is the biggest performance concern, unless the query returns many thousands of records, then the size becomes a concern. It’s really all about profiling your code to see where the performance problems lie.

    The problem here is that ajax doesn’t load large amounts of data very quickly… it’s best for small requests, not loading a giant page. There are many sites that use this technique, however, including sites like Digg.

    Pre-fetching everything and hiding them has other concerns, because it would make every page load huge, and potentially without reason.

    Finally, there would be concerns for google indexing if you are hiding half the posts, or also if the user doesn’t have javascript enabled.



    All my knowledge is usually from trial and error (and lots and lots of benchmarking).

    MySQL penalties are biggest when there’s no index for what you are searching for and how cacheable the result is. If there’s only one user online, you’ll never notice poor mysql performance. If there’s 500 users online, each making 20-30 queries, you better have decently written code.

    Loading a regular topic page is very low penalty as long as other plugins are properly using the bbcache. Many of them don’t and hammer away at mysql for every new user/post encountered.

    Ajax topic loading would be no worse than regular page loading as long as the queries are nearly identical for users, therefore the result can be cached in mysql. As long as you use OFFSET in the query, you can keep going forever down the page without preloading the entire result – the hard part is not the db code, but the ajax code. I have no clue how to do it, I’d have to do it in pseudo ajax (simple innerhtml writes) which is probably some kind of security risk.

    The bad idea about all of this is bookmarking results. If you want to send a friend a link to the 50th post which is technically on the 4nd page but you seem to be on the first page because of ajax – you’ll never be able to bookmark the 4th page. Some ajax routines dynamically change the URL to solve this by adding a cruft like #page2 after they pass that mark, which will not re-load the page in the brower but alter the bookmark if saved.

    Getting back ajax posting is probably a bigger priority than ajax reading for now. And a bit more difficult.

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