Location: PHPKode > projects > Cynus > cynus/display_func.php
<?php


/**************************
Set Template - bool set_template(int $tid)
Takes the template id and sets that as the template to be used in 
displaying the page. Return true if it was able to set it, and false
if it wasn't. The most likely causes of it returning false are it was 
already set or the template does not exist
*************************/
function set_template($tid) {
	global $config;
	
	#if the page_template is empty, we haven't set it, or it was set incorrectly
	if($config['page_template'] == '') {
	
		#we'll just do a get_template because if it exists, and this is what is
		#being set, we'll have it cached already.
		$template=get_template($tid);
		
		#so if the tempalte contained something, we know it's good
		if($template != '') {
			cynus_debug('Set the template to template ID ' . $tid);
			$config['page_template']=$tid;
			return true;
		}
		#if it didn't, then we failed
		else{
			cynus_debug('Could not set the template because one with ID ' . $tid . ' does not exist.', 2);
			return false;
		}
	}
	#the template was already set, return false
	else{
		cynus_debug('Could not set the template because it was already set.', 2);
		return false;
	}

}






?>
Return current item: Cynus