Yii Framework Forum: BasePath & Url - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

BasePath & Url Rate Topic: -----

#1 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 14 January 2009 - 08:06 AM

Are there any methods that resolve to the base path? like where index.php is located. I looked at the reference and saw only something like

Yii::app()->getBasePath();

that resolves to the protected directory.
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 14 January 2009 - 08:12 AM

http://www.yiiframew...uest#scriptFile
0

#3 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 14 January 2009 - 08:27 AM

that will return with the index.php in it. How about just the full path the index.php located in but without the actual file name. just the path? (I know i can do this easily with just removing index.php just want to make sure if anything else exists to avoid hard-coding stuff)

Thanks.
0

#4 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 14 January 2009 - 09:09 AM

Do you mean
http://www.yiiframew...Manager#baseUrl
0

#5 User is offline   Bethrezen 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 76
  • Joined: 24-December 08
  • Location:Tambov, Russia

Posted 14 January 2009 - 09:12 AM

maybe basename(...) ?
0

#6 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 14 January 2009 - 09:23 AM

@notzippy no this returns an error because i need to define the baseurl and i was talking about the basepath

@Bethrezen Nope that will return the filename for the $dir variable entered
0

#7 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 14 January 2009 - 09:34 AM

So I am assuming you want the parent directory of the protected folder ?:
dirname(Yii::app()->getBasePath())

0

#8 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 14 January 2009 - 09:48 AM

Yes exacly that code. The question was if there was a method that does that?
0

#9 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 14 January 2009 - 09:55 AM

Nope. Use dirname(Yii::app()->request->scriptFile).
0

#10 User is offline   hemc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 87
  • Joined: 09-July 12
  • Location:New Delhi

Posted 16 July 2012 - 04:41 AM

View Postnotzippy, on 14 January 2009 - 09:34 AM, said:

So I am assuming you want the parent directory of the protected folder ?:
dirname(Yii::app()->getBasePath())

thans for your comment .
it works for attaching images from the /images folder that is availavle in parent directory of protected .
Please don't add a reply to say thanks, There is already a +1 button to do same.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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