#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    England
    Posts
    107
    Rep Power
    14

    PHP page included in javascript external file


    I couldn't find a reference to this in the forums so here goes:

    I want to have a file that shows say the most recent forum posts from my PHP / MySQL forums which can be included in external sites.

    I was thinking along the lines of an external javascript file, I don't want to use frames of any sort as I don't think the sites I am working with will want it.

    The problem is I don't know if the external JS file would process the PHP does anyone have any ideas?
    Si

    -----------------------------
    ajb007 - Discuss the world of Bond
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    England
    Posts
    107
    Rep Power
    14
    It's ok I have found the answer now, or what I believe to be right, you simply include the javascript as normal but include a php page.

    <script language="javascript" src="extest.php"></script>

    Then have the php page echo javascript

    PHP Code:
    echo "document.write(\"Hello World\");"
    Which seems to work so I think this is the right way to do it unless anyone knows otherwise.
    Si

    -----------------------------
    ajb007 - Discuss the world of Bond

IMN logo majestic logo threadwatch logo seochat tools logo