Hi, thanks for the reply!
I find your array_merge() idea very useful, it will be implemented in the coming release. routes.php will be implemented in the front-end as well. All is great except that array_merge() cuts off ‘db’ of ‘components’ of the front-end array, so I’ve had to modify this as follows:
<?php
$backend=dirname(dirname(__FILE__));
$frontend=dirname($backend);
Yii::setPathOfAlias('backend', $backend);
$frontendArray=require($frontend.'/config/main.php');
// This is the main Web application backend configuration. Any writable
// CWebApplication properties can be configured here.
$backendArray=array(
'basePath' => $frontend,
'controllerPath' => $backend.'/controllers',
'viewPath' => $backend.'/views',
'runtimePath' => $backend.'/runtime',
// autoloading model and component classes
'import'=>array(
'backend.models.*',
'backend.components.*',
'application.models.*',
'application.components.*',
'application.extensions.*',
),
// main is the default layout
'layout'=>'main',
// alternate layoutPath
'layoutPath'=>dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'_layouts'.DIRECTORY_SEPARATOR,
// application-level parameters that can be accessed
// using Yii::app()->params['paramName'] and MParams class
'params'=>require(dirname(__FILE__).'/params.php'),
// application components
'components'=>array(
'urlManager'=>array(
'rules'=>require(dirname(__FILE__).'/routes.php'),
),
),
);
if(!function_exists('w3_array_union_recursive'))
{
/**
* This function does similar work to $array1+$array2,
* except that this union is applied recursively.
* @param array $array1 - more important array
* @param array $array2 - values of this array get overwritten
* @return array
*/
function w3_array_union_recursive($array1,$array2)
{
$retval=$array1+$array2;
foreach($array1 as $key=>$value)
{
if(is_array($array1[$key]) && is_array($array2[$key]))
$retval[$key]=w3_array_union_recursive($array1[$key],$array2[$key]);
}
return $retval;
}
}
return w3_array_union_recursive($backendArray,$frontendArray);
Please to all: share your ideas here, we are looking to make this app more universal to fit everyone’s needs.
I currently don’t have much free time for documentation, but hope to start Wiki in October (this year
). We hope that someone will help us with some aspects of this project, or at least with finding bugs and bringing some better ideas, like you did, thank you.
All the default values in MParams component already are in config/params.php, e.g.
const defaultLanguage='en';
in MParams is nothing more than a repeat of
'language'=>'en', //en
in params.php. The purpose of MParams default constants is to keep the app alive even if developer will do something wrong in config/params.php. Default values in MParams are fired ONLY if corresponding config in params.php is missed. The end goal is to make app working even if params.php returns an empty array
(this should be finished in the next release) I will try to simplify this component.
Good idea. I like markitup as simplified editor (with different types of markup), and CKEditor as WYSIWYG editor. Also we are going to use jqGrid for grids of data. But, all pages should be 100% working with javascripts disabled.
// WORKING WITH DATES
Also, currently we are going to switch from
`createDate` DATETIME NOT NULL,
`createGmtDate` DATETIME NOT NULL,
to
`createTime` INTEGER(10) UNSIGNED NOT NULL,
The purpose of Gmt field was to convert dates from db to visitor’s timezone. With time() we can still convert it to timezones (because time() in the same moment in all timezones is the same value) and using FROM_UNIXTIME(createTime) we can work with field as if it would be datetime. So, we can use 1 field instead of 2. The cost is less human readability when you look at it in phpMyAdmin.
But this approach will be applied to fields auto-filled in by app only. Those that are filled in by human will be of type DATETIME (like startDate
,endDate
), so it can be any date, even before Unix Epoch (January 1 1970 00:00:00 GMT)
, see http://www.yiiframework.com/forum/index.php?/topic/3187-working-with-dates-need-your-input/ for reference
// END WORKING WITH DATES
Please, share your thoughts.