Theme As Module

Greetings, I have the next question.

I am currently developing a base theme for use by all developments in the place where I work. The point is that the theme comes with some extensions, documentation, and application settings, the problem arises when we implement this in all developments hat we make with Yii. When the theme is implemented, we have to edit the main.php file to use it.

What I want to know is if there is any way to have this theme as a module, so we only have to import the module in the protected/config/main.php general config, and in the protected/modules/theme/config/main.php (config from module) add the aditional preferences to use the theme.

Currently, to use the theme, I declare in the protected/config/main.php file:


'theme' => 'item',

But this theme is in themes/theme, so, I could have this assignment in the configuration of the module, so when I import the module in the protected/config/main.php, the preferences in protected/modules/theme/config/main.php will overwrite the general preferences, but how I tell Yii that the theme to be used will be in protected/modules/theme

Thanks :)

I save my config params and settings in a file (or you can use a db). I also have a form to edit the settings in my admin panel. My themes are just a dropdown list that reads the file names under themes.

I put all my site info in params too i.e. site name, copyright, descriptions etc and i use them at the top of all my theme main files so i don’t have to edit every theme and i can use the same themes for multiple sites without changing head info.


<head>

	<meta charset="utf-8">

	<title><?php echo Yii::app()->name; ?> - <?php echo Yii::app()->params['tagline']; ?> | <?php echo Yii::app()->params['phone']; ?></title>

	<title><?php

	if (isset($this->pageTitle))

	{

	echo $this->pageTitle.' | '.Yii::app()->params['company'].' | '.Yii::app()->params['tagline'];

	}

	else {

	echo Yii::app()->params['company'].' | '.Yii::app()->params['tagline'].' | '.Yii::app()->params['phone'];

	}; ?>

	</title>

	<meta name="description" content="<?php if (!empty($this->pageDescription))

	{

	echo $this->pageDescription;

	}

	else

	echo Yii::app()->name.' '.Yii::app()->params['tagline'].' of '.Yii::app()->params['city'].' '.Yii::app()->params['state'];

	?>

	" />

	<meta name="owner" content="<?php echo Yii::app()->params['company']; ?>">

	<meta name="author" content="<?php echo Yii::app()->params['company']; ?>">

	<meta name="copyright" content="Copyright <?php echo date('Y') .' '. Yii::app()->name.'&trade; v'. Yii::app()->params['version'].' by '.Yii::app()->params['company']; ?>">

	<meta name="keywords" content="

	<?php

	$keyword_tags = Tags::model()->findAll();

	foreach ($keyword_tags as $keyword_tags){

	echo $keyword_tags->name.', ';

	}

	echo Yii::app()->name.', '.Yii::app()->params['tagline'].', '.Yii::app()->params['city'].', '.Yii::app()->params['state'];?>

	">

	<title><?php echo isset($this->pageTitle) ? $this->pageTitle.' '.Yii::app()->name : Yii::app()->name.' - '.Yii::app()->params['tagline']; ?> </title>

</head>

my params are something like this


	'params'=>array(

        	'defaultPageSize'=>20,

        	'tagCloudCount'=>20,

        	'adminTheme'=>'admin',

        	'frontEndTheme'=>'frontend',

        	// this is used in contact page

        	'email'=>'email@email.com',

        	'version'=>'2.0.1',

        	'company'=>'Company Name',

        	'tagline'=>'Company Tag Line',

        	'phone'=>'888-423-4567',

        	'city'=>'Louisville',

        	'state'=>'KY',

        	'zip'=>'40217',

        	'website'=>'yiiframework.com',

        	'owner'=>CHtml::link('mycompay&trade;', 'http://www.yoursite.com', array('target'=>'_blank')),

        	'mon_open_hours'=>'11:00',

        	'mon_closed_hours'=>'22:00',

        	'tue_open_hours'=>'11:00',

        	'tue_closed_hours'=>'22:00',

        	'wed_open_hours'=>'11:00',

        	'wed_closed_hours'=>'22:00',

        	'thu_open_hours'=>'09:00',

        	'thu_closed_hours'=>'10:00',

        	'fri_open_hours'=>'11:00',

        	'fri_closed_hours'=>'22:00',

        	'sat_open_hours'=>'11:00',

        	'sat_closed_hours'=>'01:00',

        	'sun_open_hours'=>'11:00',

        	'sun_closed_hours'=>'24:00',

    	),

I have a file that i can edit in my admin panel via form fields to update the info.