Example #1
0
function tpl_block($name, $value = ''){

	if(is_array($name)){
		foreach($name as $k => $v) tpl_block($k, $v);
		return;
	}

	global $tpl_blocks;
	$tpl_blocks["'\\[".$name."\\](.*?)\\[/".$name."\\]'si"] = $value;
}
Example #2
0
	tpl_set(array(
		'{my_id}' => $uid,
		'{name}' => $uinfo['name'].' '.$uinfo['lname'],
		'{head_req}' => $uinfo['friends_request'] > 0 ? '+'.$uinfo['friends_request'] : ''
	));
}

if($st_files){
	$st_res = '';
	foreach($st_files as $file){
		if(strpos($file, '.js') !== false) $st_res .= '<script type="text/javascript" src="/js/'.$file.'"></script>';
		else $st_res .= '<link rel="stylesheet" type="text/css" href="/css/'.$file.'"/>';
	}
	tpl_set('{st_files}', $st_res);
}else tpl_set('{st_files}', '');


tpl_set(array(
	'{cont}' => $tpl_res['cont'],
	'{title}' => $site_title ? $site_title : 'FastChat',
	'{init_js}' => $initJS
));
if($logged) tpl_set(array('[logged]' => '', '[/logged]' => ''));
else tpl_block('logged');
tpl_make('main');

echo $tpl_res['main'];

//$time = microtime(true) - $start;
//printf('<br>Скрипт выполнялся %.4F сек.', $time);