Quote:
|
Originally Posted by jasonlambert the problem is the inefficient SQL (a recurring issue with phpbb...) phpbb uses to generate the list.
As it doesnt change that often, i'll work out the best way to generate the box once, cache it, then i'll give each user a profile option to add it back into the page if they so wish. |
Let me clear my side first:
I've done a little bit of PHP and MySQL stuff - so I have a small idea of what goes into it.
I don't know the table structure used by phpbb - have not used it for ages now. So, I could be completely wrong.
Well, I don't see why it should be inefficient SQL - at least with respect to what we're discussing here...
Generally, the no. forums would be fairly static - you don't keep adding or removing a forum every day or hr. So, you could just create a caching table - if required - that could store the relative URL of forums - say
file.php?func=showforum&forum=xx - and index by the forum ID.
Now, while generating the index page of the forum where all the forums are anyway listed, you could cache the forums - titles and IDs - in this table. Or, when you add or remove the forum, just update this table.
While populating the drop-down, you just have to fire a SELECT query on this table which already has the forum ID, title and the URL. So, the HTML SELECT would be directly coded using PHP like
Code:
<SELECT name=xyz onSelectionChanged=window.refresh(document.formx.xyz.options[document.formx.xyz.selectedIndex])>
<?php
for($counter = 0; $counter < $n_forums; $counter++)
echo "<option value=$url>$title</option>";
?>
</SELECT>
Now, if the forums are fairly constant, it could very well be put in a static PHP array - in which case, you won't even have to query the DB, plus not too much of JavaScript needed..

Note that I don't remember the syntax correctly right now - so there are bound to be syntactical errors in the above code.
But the point is I don't see why it could be so inefficient.
Instead, when you have to move to the index page of the forum whenever you have to move to a different forum, you're possibly going to call the same SQL so many times and the page will be regenerated so many time - though there is a possibility of caching the index page. But in case of caching, the iicons won't be reflected properly - in fact, most of the status information won't be reflected properly; you won't get the latest of who's posted, any new posts in a forum etc.
Also, for x HTTP requests (x > 1 - for not having the drop-down), the browser is making and breaking x TCP connections - 3 * x TCP handshakes. And when you have the drop-down (or SOME mechanism of moving to the required forum directly), you have 1 HTTP request, 1 TCP connection and 1 * 3 TCP handshakes... (just kidding... :P :P

)
Please please please.....
if I'm wrong - which could be highly possible - please correct me....
I'll be more than happy to accept my mistake...
