Recent Topics

1 Sep 16, 2005 09:12    

I believe this is a PHP-related question, more so than Client-Side Stuff; correct me if not.

On my site, I am running forums (using phpBB) as well as my blog, and the forums are under a separate domain name. Using the "Topics Anywhere" phpBB MOD, I can insert topic titles into the main page of the blog, and they load dynamically.

This, unfortunately, makes my main page load very slowly. [url=http://thinkblog.org/]See for yourself[/url]: I don't know if it's a domain-resolving issue or a PHP issue, but I'm thinking the latter, and since that's the only thing I can do anything about, I'm asking for advice.

What I think needs to be done is to load the topics-snippet into its own (PHP? XHTML? TXT?) file, then load *that* into b2evo's main.php straight on. (I could update the "Topics Anywhere" bit with a cron script, server-side, hourly or whatever.)

I'm not sure exactly how to accomplish this. Any ideas?

(Main page is http://thinkblog.org/ ; http://thinkforums.org/ is where these dynamic titles are coming from, but it's the same physical machine.)

2 Sep 16, 2005 10:31

there are a few ways to handle that, though to be honest I didnt think it loaded all that slow. There was a slight delay with some white space, but it wasnt too terrifically long.

both domains on the same box .. ok. same mysql db also or no? I could donwload that phpBB mod and look but i will let you answer instead.. is that mod going out to the domain via some web technology, or is it making a direct db call?

You might do a cpl things .. but first I would benchmark that page. You can do that a cpl ways but for now b2evo has a built in debugger : inside b2evocore/_functions.php locate the line that says

function debug_info( $force = false )

and make that true. After doing that youre going to see way too much info at the bottom of your page. What your most interested in there will be the amount of database calls, AND the page generation time (php processing)...

If it still looks like a php issue and not the db calls thats slowing things down then you could cache those topic titles, and go get them using a simple script OR you could just use a simple script that queries that database (i would do one of those 2) or you could parse the RSS feed for your forum (IF thats not how that mod is already doing it). The RSS feed mods for phpBB are very easy to install -- parsing out the proper info from there isnt much harder.

3 Nov 05, 2005 08:44

I never did actually thank you for your help--thank you!

It's basically querying the phpBB code through embedded JavaScript--so that's what, three levels of computation deep? I'm going to look into the RSS phpBB MODs instead.

Thanks for your reply and be well!

4 Nov 05, 2005 10:26

If you have b2evo and phpbb in the same database, try doing something like this instead of using your javascript


<?php
$sql = 'SELECT DISTINCT phpbb_posts.topic_id,phpbb_topics.topic_title
FROM phpbb_posts JOIN phpbb_topics ON phpbb_topics.topic_id = phpbb_posts.topic_id
ORDER BY post_time DESC limit 10';

$topics = $DB->get_results( $sql, ARRAY_A);

echo '<ul>';

foreach( $topics as $topic)

echo '<li><a href="http://thinkforums.org/viewtopic.php?t='.$topic['topic_id'].'" title="read this post">'.$topic['topic_title'].'</a></li>';

echo '</ul>'
?>


¥


Form is loading...