1
ralf57
How can i retrieve xoops folder name from XOOPS_ROOT_PATH?
  • 2004/10/5 14:23

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


Hi all,
on my install i have:
XOOPS_ROOT_PATH >>> /srv/www/htdocs/my_xoops_install
I need to extract "my_xoops_install" from the path
and put it in a variable (ex. $folder).
How can i get it?
Thanks in advance,ralf.

2
Dave_L
Re: How can i retrieve xoops folder name from XOOPS_ROOT_PATH?
  • 2004/10/5 14:43

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


$folder substr(XOOPS_ROOT_PATHstrrpos(XOOPS_ROOT_PATH'/') + 1);


P.S. If this is intended for a module, or code that others would use, it needs to be more general (handle \ as well as /), and maybe should check for errors such as XOOPS_ROOT_PATH having a trailing /.

3
ralf57
Re: How can i retrieve xoops folder name from XOOPS_ROOT_PATH?
  • 2004/10/5 15:23

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


Quote:

Dave_L wrote:
$folder substr(XOOPS_ROOT_PATHstrrpos(XOOPS_ROOT_PATH'/') + 1);


P.S. If this is intended for a module, or code that others would use, it needs to be more general (handle \ as well as /), and maybe should check for errors such as XOOPS_ROOT_PATH having a trailing /.


Thank you Dave,
it works perfectly.

4
Dave_L
Re: How can i retrieve xoops folder name from XOOPS_ROOT_PATH?
  • 2004/10/5 15:34

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


This also seems to work:

$folder basename(XOOPS_ROOT_PATH);


basename is intended for extracting a filename, not a directory name. But since directory names and filenames are syntactically indistinguishable, I guess there's nothing wrong with using basename for this purpose.

Login

Who's Online

296 user(s) are online (212 user(s) are browsing Support Forums)


Members: 0


Guests: 296


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits