Topic: forum_info and other tpl "fillers" run even without match?

This is really just a minor efficiency "bug", limited to modified tpl files.

index.php ~= line 260 to 369 there's a bunch of stuff going down to find out number of users, etc... Nothing to resource intensive. Anywho, in my main.tpl I've removed the "<!-- forum_info -->" tag. Now that 100+ lines of code still get's run.

If you add this

  // START SUBST - <!-- forum_info -->
+ if (strpos($tpl_main, '<!-- forum_info -->'))
+ {
  ob_start();

  ($hook = get_hook('in_info_output_start')) ? eval($hook) : null;

and this

  $tpl_temp = forum_trim(ob_get_contents());
  $tpl_main = str_replace('<!-- forum_info -->', $tpl_temp, $tpl_main);
  ob_end_clean();
+ }
// END SUBST - <!-- forum_info -->

then your not running that code that will never get displayed (depending on the .tpl text).

I'm guessing the same can apply to many other tpl tags. With extensions it might be a safer policy to add this at the end of the if:

else {
    ($hook = get_hook('in_info_output_start')) ? eval($hook) : null;
    ($hook = get_hook('in_stats_qr_get_user_count')) ? eval($hook) : null;
    // ... for each addition extention hook within the scope of the if statement
}
// or just make a new hook
//
//else {
//    ($hook = get_hook('in_info_output_skipped')) ? eval($hook) : null;
//}

Of course some extensions or other pieces of code may depend or expect the code to run. Particularly with tpl tags like "<!-- forum_main -->". I'll let someone else make the decision on what tpl tags should have conditional execution. It's been a while since I've played with PunBB (and a major version change; Which I love wink), I don't know the code well enough to comment on which tpl tags are safe to silently "skip".

Also, strpos may not be as efficient as another php function, or should be tested on a "pure" $tpl_main and other tpl variables, with results stored to be used later.

echo "deadram"; echo; fortune;