WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] php if (file_exists...) outside of the temple path... (6 posts)

  1. SimonJ
    Member
    Posted 6 years ago #

    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.

  2. whooami
    Member
    Posted 6 years ago #

    you can do this:

    if (file_exists(dirname(__FILE__)."/wp-content/themes/theme-name/blah.php"))
     {
  3. SimonJ
    Member
    Posted 6 years ago #

    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.

  4. SimonJ
    Member
    Posted 6 years ago #

    Ok! I got it!...

    file_exists('../xyz/abc/blahblahblah')

    S.

  5. whooami
    Member
    Posted 6 years ago #

    that works too :)

  6. SimonJ
    Member
    Posted 6 years ago #

    I know it's not a php forum... :-) But could you give me more details on "dirname(__FILE__)." ?

    Thanks

    S.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.