Set Alias

I am using Mac and its built-in php.

In main.php, i did this


Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

but it does not work, so, in an index.php, i wrote:


<?php echo Yii::getPathOfAlias('bootstrap');?>

and the webpage show:

[color="#FF8C00"]/Library/WebServer/Documents/tpl/protected/config/../extensions/bootstrap[/color]

that’s wrong!

i think is should be

[color="#FF8C00"]/Library/WebServer/Documents/tpl/protected/extensions/bootstrap[/color]

Please how to write the right "setPathOfAlias"?

now i change


Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

to


Yii::setPathOfAlias('bootstrap', dirname(dirname(__FILE__)).'/extensions/bootstrap');

so the output of


<?php echo Yii::getPathOfAlias('bootstrap');?>

turns to be

[color="#FFA500"]/Library/WebServer/Documents/tpl/protected/extensions/bootstrap[/color]

it seems right, because the fold is right one.

but


<?php $this->beginWidget('bootstrap.widgets.TbHeroUnit',array(

    'heading'=>'Welcome to '.CHtml::encode(Yii::app()->name),

)); ?>

still throws exception

[color="#FFA500"]Alias "bootstrap.widgets.TbHeroUnit" is invalid. Make sure it points to an existing PHP file and the file is readable. [/color]

can someone help me please?

problem solved!

the reason was ‘no permissions to access files’…

so,

chmod 777 -R

Hi aslan,

Can you explain how you done it?

Thanks in advance :rolleyes: