https://www.icyphoenix.com/viewtopic.php?f=17&t=10164&p=62170#p62170 ----------------------------------- mort Wed 26 Feb, 2020 12:22 Re: Caching Includes? ----------------------------------- Unlike PHPBB tpl files which uses proxy VARS to swap in the php. I'm separating all of the Db queries, and anything else that takes up most of the php files and swapping them back in with functions. I started doing it with a "functions-config file I'm using to put them in - but it's getting pretty large, so no doubt I'll have to create a function file for every php file and call them back in using functions per file? [b]Too Easy![/b] but time consuming. But it separates the html from the php, then I'll just cache the php file which will be a proxy html/tpl file. :P Have a look at the html versus php in this example. :) And this is only a "little one"! :shock: [code linenumbers=false]prepare($pdo); $stmt->execute(); $row_count = $stmt->rowCount(PDO::PARAM_INT); $totalcount = $row_count; $totalpages = ceil($totalcount / $max); /*** End This is used only for the Count ***/ $stmt = $database->prepare("SELECT userid, username, user_level, blog_level, game_level, status, plays FROM " . USERS_TABLE . " WHERE activation_key=0 AND user_level!=0 ORDER BY $order LIMIT $limits,$max"); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); echo ' '.IMG_THL.''.$lang['memberlist'].''.IMG_THR.SCRST.' '; foreach( $result as $row ) { $member_name = htmlEsc($row['username']); $member_id = intval($row['userid']); $user_level = intval($row['user_level']); $blog_level = intval($row['blog_level']); $game_level = intval($row['game_level']); $plays = intval($row['plays']); if($row['status'] >= time()-15*60){ $status=''.IMG_ONL.''; }else{ $status=''.IMG_OFL.''; } include "".BLOCKS_COMMON."ranks.php"; echo ' '; } echo '
'.ICO_SM_ASC.' ID '.ICO_SM_DESC.' '.ICO_SM_ASC.' '.$lang['name'].' '.ICO_SM_DESC.' '.ICO_SM_ASC.' '.$lang['plays'].' '.ICO_SM_DESC.' '.ICO_SM_ASC.' '.$lang['rank'].' '.ICO_SM_DESC.' '.ICO_SM_ASC.' '.$lang['status'].' '.ICO_SM_DESC.' '.$lang['profile'].'
'.$member_id.' '.$member_name.' '.$plays.''; if($user_level == '2'){echo ''.$lang['admin'].'';}else{ if($game_level == '2' || $blog_level == '2'){echo ''.$lang['jr_admin'].'';}else{ if($user_level != '2' || $game_level != '2' || $blog_level != '2'){echo ''.$lang['member'].'';} } } echo ' '.$status.' '; if($usrdata['user_level'] !=0){ echo '  '.IMG_PRO2.' '; }else{ echo '  '.$lang['view_profile'].''; } echo '
'.SCRSB.IMG_THB.'

'.$lang['pages'].': '; for($i = 1; $i <= $totalpages; $i++){ if($page == $i){$PageAt = 'page-at';}else{$PageAt = 'pagination';} echo ' '.$i.''; } echo '

'; include "".TEMPLATE."overall_footer.php"; ?>[/code]