now i want to display some articles title which from another forum. and put the articles' title on the page-front.tpl.php.maybe i can write the database connection and query code into the page-front.tpl.php directly. but this is too bad for efficiency. in order to get a hign efficiency. how should i do. the version of drupal is drupal 6
See http://drupal.org/node/18429 on how to connect to another database by using the provided API. Note that in D6, you can only connect to the same database type (mysql/pgsql) as your default db is.
As googletorp already noted, you should not execute queries or do any processing inside theme functions/templates.
You for example do it inside a hook_preprocess_page() function and then just display it in your template.
Or even better, if that works for you, would be to write a simple module that exposes a block which you can then place wherever you want in your theme. See hook_block(). With that, Drupal can take care of the caching for you, you just need to define how it is supposed to be cached (global, per role, ..). This is all described on the linked documentation page above.