Support » Fixing WordPress » php if (file_exists…) outside of the temple path…

  • Resolved SimonJ

    (@simonj)


    Ok, I need a php wordpress guru here… 🙂

    Usually, I call the php function file_exist for files located in my wp theme from function.php …

    So I usually use :

    if (file_exists(TEMPLATEPATH.’blahblahblah’) )

    But, now i need to call this fuction for a file elsewhere in my public_html

    I tried ‘home/user/public_html/blahblahblah’ , but it doesn’t work…

    Don’t you have any hint for me ?

    Thanks!

    S.

Viewing 5 replies - 1 through 5 (of 5 total)
  • whooami

    (@whooami)

    Member

    you can do this:

    if (file_exists(dirname(__FILE__)."/wp-content/themes/theme-name/blah.php"))
     {
    SimonJ

    (@simonj)

    he he he… Sorry If sound dumb :-))

    My WP is, let’s say, in : public_html/wp/

    And I want the function to look in public_html/xyz/abc/

    S.

    SimonJ

    (@simonj)

    Ok! I got it!…

    file_exists(‘../xyz/abc/blahblahblah’)

    S.

    whooami

    (@whooami)

    Member

    that works too 🙂

    SimonJ

    (@simonj)

    I know it’s not a php forum… 🙂 But could you give me more details on “dirname(__FILE__).” ?

    Thanks

    S.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘php if (file_exists…) outside of the temple path…’ is closed to new replies.