Yii Framework Forum: Most proper and fastest way to determine root directory for url creation - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Most proper and fastest way to determine root directory for url creation like for registerCssFile etc. Rate Topic: -----

#1 User is offline   migajek 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 15-November 09

Posted 03 January 2010 - 05:36 PM

Hi,
I'm a newbie here, I'd like to know what is the most proper and fastest way to give full path of CSS file for CClientScript registerCssFile function, but also many other functions?

Thanks!
m
0

#2 User is offline   CoLT 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 246
  • Joined: 22-November 09

Posted 03 January 2010 - 06:00 PM

View Postmigajek, on 03 January 2010 - 05:36 PM, said:

Hi,
I'm a newbie here, I'd like to know what is the most proper and fastest way to give full path of CSS file for CClientScript registerCssFile function, but also many other functions?

Thanks!
m


Hi,

This might solve your question:
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl.'/css/form.css');

0

#3 User is offline   migajek 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 15-November 09

Posted 04 January 2010 - 05:04 AM

thanks, I thought there is maybe some alias or so ...

anyway should I do it like this or use assets manager?

could anyone explain when to use which way?

thanks
0

#4 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 244
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 09 February 2010 - 12:08 PM

I think this is no more working, the following code shows a blank page :
echo Yii::app()->getbaseUrl;exit;

And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#5 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 09 February 2010 - 12:34 PM

View Postsaegeek, on 09 February 2010 - 12:08 PM, said:

I think this is no more working, the following code shows a blank page :
echo Yii::app()->getbaseUrl;exit;



echo Yii::app()->baseUrl;

or
echo Yii::app()->getBaseUrl();

or
echo Yii::app()->getBaseUrl(true);

(absolute URL)

/Tommy

This post has been edited by tri: 09 February 2010 - 12:44 PM

Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users