Can't Get The Correct Url Path


If my Yii app is located in this directory http://localhost/public_html/mywebapp/

how do I tell my code below that I wanted it to automatically be set under the dir above?



 *  Extending CLinkPager so that we can give it a custom css file


class LinkPager extends CLinkPager


        public $cssFile = '/css/pager.css';


Dear Friend

If the following is the path of pager.css


Then the following would work

public $cssFile = 'css/pager.css';


Hi corbeeresearch

You could use also

public $cssFile = Yii::app()->baseUrl . '/css/pager.css';

I get this error

Parse error: syntax error, unexpected ‘(’, expecting ‘,’ or ‘;’ in /var/www/public_html/tots/protected/components/LinkPager.php on line 8

Unfortunately, I tried it, and didn’t work.

Sorry about that

Anywhere in my application, I can do the following to get contents of main.css in css folder.


echo file_get_contents($file);


Try this

public $cssFile;

 public function init()


          $this->cssFile = Yii::app()->baseUrl . '/css/pager.css';

	  return parent::init();


Thanks, that does the trick!