very small problem, 1 line, can anyone help please

Discussion in 'Programming' started by nevret2, Apr 18, 2008.

  1. #1
    i have 2 folders

    folder1
    folder2

    in folder i have theme.php

    in folder 2 i have index.php

    how can i call theme.php (in folder 1) in index.php (in folder2)?

    i have used domain.com/folder1/theme.php in index.php( in folder 2) but it doesnt works, becuase it cant read php files in browser

    i have tried /public_html/nevret/folder1/theme.php, but then it makes it domain.com/public_html/nevret/folder1/theme.php

    how can i do this?

    thnx very much,
     
    nevret2, Apr 18, 2008 IP
  2. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #2
    <?php include '/folder1/theme.php'  ;?>
    Code (markup):
     
    Bagi Zoltán, Apr 18, 2008 IP
  3. nevret2

    nevret2 Peon

    Messages:
    518
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i have not only theme.ph i have like
    theme.php
    wp.php
    imag.php

    all in index.php

    how can i let them all see where they are in folder1?
     
    nevret2, Apr 18, 2008 IP
  4. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #4
    You need to continue listing the includes
    <?php 
    include '/folder1/theme.php'  ;
    include '/folder1/wp.php'  ;
    include '/folder1/imag.php'  ;
    ?>
    Code (markup):
     
    Bagi Zoltán, Apr 18, 2008 IP
  5. Webray

    Webray Active Member

    Messages:
    469
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Bagi Zoltán has it.

    You can't use an url to include files, you must use a machine path.

    Another method would be like this:
    require ("folder1/imag.php") ;
    or
    require_once("folder1/imag.php") ;
     
    Webray, Apr 18, 2008 IP
  6. nevret2

    nevret2 Peon

    Messages:
    518
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    but if i use:

    include '/folder1/theme.php'  ;
    include '/folder1/wp.php'  ;
    include '/folder1/imag.php'  ;
    Code (markup):
    and i put this in the pgh file in folder2, it will read as:

    /folder2/folder1/theme.php
    /folder2/folder1/wp.php
     
    nevret2, Apr 18, 2008 IP
  7. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #7
    Try this
    include './folder1/theme.php'  ;
    include './folder1/wp.php'  ;
    include './folder1/imag.php'  ;
    Code (markup):
     
    Bagi Zoltán, Apr 18, 2008 IP
  8. nevret2

    nevret2 Peon

    Messages:
    518
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Warning: require_once(/home/nevret/public_html/yourdepo/god/2/wp-includes/classes.php) [function.require-once]: failed to open stream: No such file or directory in /home/nevret/public_html/yourdepo/god/2/wp-blog-header.php on line 8

    Fatal error: require_once() [function.require]: Failed opening required '/home/nevret/public_html/yourdepo/god/2/wp-includes/classes.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/nevret/public_html/yourdepo/god/2/wp-blog-header.php on line 8
     
    nevret2, Apr 18, 2008 IP