Yii framework classes are prefixed with letter C. Version 2.0 will use namespace and will remove C letter?
Page 1 of 1
Yii core classes will be namespaced?
#2
Posted 05 January 2012 - 07:09 PM
Yes
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application
Gustavo Salomé Silva
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application
Gustavo Salomé Silva
#3
Posted 20 February 2013 - 09:24 AM
I was wondering if there will be a new best-practice way to extend classes with namespaces.
As an example, if I want to extend CHtml or \Yii\Html maybe.
If my namespace takes precedence I could use Html to access both objects.
or
Would this be a recommended way?
As an example, if I want to extend CHtml or \Yii\Html maybe.
class \MyNamespace\Html extends \Yii\Html {
function myFunc(){
...
}
}If my namespace takes precedence I could use Html to access both objects.
Html::tag()
or
Html::myFunc()
Would this be a recommended way?
Phundament - Yii Application Boilerplate with composer support
Fork on github
Follow phundament on Twitter
DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
Fork on github
Follow phundament on Twitter
DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
#5
Posted 22 February 2013 - 02:22 PM
schmunk, on 20 February 2013 - 09:24 AM, said:
I was wondering if there will be a new best-practice way to extend classes with namespaces.
As an example, if I want to extend CHtml or \Yii\Html maybe.
If my namespace takes precedence I could use Html to access both objects.
or
Would this be a recommended way?
As an example, if I want to extend CHtml or \Yii\Html maybe.
class \MyNamespace\Html extends \Yii\Html {
function myFunc(){
...
}
}If my namespace takes precedence I could use Html to access both objects.
Html::tag()
or
Html::myFunc()
Would this be a recommended way?
Or you could alias the classname to have a more obvious naming:
<?php
namespace My\Namespace;
use \Yii\Web\HTML as YHTML;
use My\Namespace\HTML as EHTML;
class HTML extends YHTML{
}
echo EHTML::tag();
Share this topic:
Page 1 of 1

Help
This topic is locked













