LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-03-2005, 02:55 AM   #1
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Rep: Reputation: 45
php: assign $var to 1 folder above.


Hi all =)

If i have a .php in a folder,
/path/to/install/my.php

and in the .php, it has the following
PHP Code:
$config['path'] = dirname(__FILE__).'/'
config['path] will be assigned as /path/to/install/
as you would see if you echo config['path'];

However, is there a way to assign it one directory above ? so that config['path'] would be
/path/to/
?

Thanks.
 
Old 08-03-2005, 03:19 AM   #2
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,183

Rep: Reputation: 98
According to the manual you can do
PHP Code:
$config['path'] = dirname(dirname(__FILE__)).'/'
dirname and basname treat directories as files.
 
Old 08-03-2005, 04:16 AM   #3
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Original Poster
Rep: Reputation: 45
Heh, i wouldn't have thought of that..

Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/var/tmp folder hardeep_ubhi Linux - General 4 10-02-2006 07:10 AM
Assign CHMOD Rights To Mapped Windows Folder, GaneshParam Linux - Security 0 08-03-2005 05:09 AM
PHP var problem DropHit Linux - Software 1 06-01-2005 05:39 PM
assign a file/folder two groups? student04 Linux - General 2 12-19-2004 10:47 PM
Need to assign result of grep to var in PERL amytys Programming 1 09-23-2004 06:25 PM


All times are GMT -5. The time now is 06:42 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration