The MU forums have moved to WordPress.org

php Include() function (4 posts)

  1. arlob
    Member
    Posted 16 years ago #

    Hi,

    I tried to have the include() function inside a post to call a file from another location, but this would not work.

    Tried to have something like:
    <?php include("http://www.domain.com/folder/file.html"); ?>

    I wanted to make this for the following...

    When a new user is registered, the Blog creates a "Profile" page for him. So I thought..what if we also
    give the user another page which contains a chat, and also a page which contains music, since that is a section
    we have in the main website.

    But if we give the user a static page, what happens
    when we updated it...that is why I thought of using
    the include() function to have the page pulled from
    another location.

    Does anyone know how this can work well ?

    We'd appreciate it very much!

    Thank you.

  2. shredder
    Member
    Posted 16 years ago #

    This might help:

    http://codex.wordpress.org/Stepping_Into_Templates

    outlines the following for the format of an include:

    <?php include (TEMPLATEPATH . '/searchform.php'); ?>

    Its in hte section titled "Template Files Within Template Files"

  3. andrewbillits
    Member
    Posted 16 years ago #

    "I tried to have the include() function inside a post to call a file from another location, but this would not work."

    You can't incluse PHP code withen a post for security reasons. However, there is a plugin available that allows you to run php code on pages. You might want to check and see if it works for posts as well.

  4. shredder
    Member
    Posted 16 years ago #

    doh! sorry arlob I misread your requirements; I misread the part where you mentioned you were trying to do your include within a post and took it to mean within a page (template)

About this Topic