Jump to content


Photo

How to control Glob(


  • Please log in to reply
4 replies to this topic

#1 acroporas

acroporas
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 27 September 2006 - 04:03 AM

I'm trying to figure out how to control which folder the glob( function looks at?  (I've noticed that it does not allways search the same folder that the php file calling the function is in.) 

Is there a website that goes into more detail about the funtions than what is found in the php manual.


Also, is there a better way to get the list of files in a folder that is more easily controlable?

Thanks

Will



#2 acroporas

acroporas
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 27 September 2006 - 01:14 PM

Anyone?

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 September 2006 - 03:24 PM

I've never had a problem using the glob() function. What problems are you having?

Do you have code samples you can post?

Ken

#4 acroporas

acroporas
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 28 September 2006 - 02:18 AM

It is difficult to post code snippets as  the problem is not in just one line but I can explain one example of what I call 'hard to control' 

I have the following file system.

home directory
          header.php

          child directory 1
                  page.php

         child directory 2
                 java.js

page.php has in it the line:    include ( ../header.php )
and
header.php has in it the line:  glob('*.*')

Case 1:  header.php has the line "../child-directory2/java.js"
Glob returns files in home directory.

Case 2:  header.php has the line "http://www.home directory.com/child directory 2/java.js"
Glob returns files in child directory 1

Edit...I've change my code significantly so this is from memory so it may not be exactly as it was.  But the theme is accurate.  Changing how I refrenced the .js file from a relative link to a absolute link changed wich directory glob would search.

#5 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 28 September 2006 - 05:02 AM

If you can create pieces of code that show the problem, it would be much better.

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users