Sunday, February 12, 2012

For getting entry script file path in Yii

If you want to return entry script file path (www directory without index.php), you can use the following code. It works great.

dirname(Yii::app()->request->scriptFile);


This results in the full directory names of the web root.
e.g. /home/example.org/www/yii/protected

http://www.yiiframework.com/forum/index.php?/topic/536-basepath-url/page__hl__scriptFile%20__fromsearch__1

The one below returns " /yii/protected/ ".

<?php echo Yii::app()->request->baseUrl; ?>

No comments: