1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Use external PHP file in my HTML file

Discussion in 'PHP' started by Vanditneel, Feb 25, 2011.

  1. #1
    Hello friends,
    I have designed HTML website. I want to run an external PHP file from my HTML code.
    How can I achieve this? Can you suggest me that whether IIS server supports php files?
    Need a quick reply..
    Thanks in advance...
     
    Vanditneel, Feb 25, 2011 IP
  2. G3n3s!s

    G3n3s!s Active Member

    Messages:
    325
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #2
    you have to change it to php file or set it in php.ini
     
    G3n3s!s, Feb 25, 2011 IP
  3. Vanditneel

    Vanditneel Active Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    So I cant use it in any HTML file?
     
    Vanditneel, Feb 25, 2011 IP
  4. G3n3s!s

    G3n3s!s Active Member

    Messages:
    325
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #4
    I think there is way to do it, but something like this way

    <?php
    $myTemplate = file_get_contents("index.html");
    preg_match_all("/<-- PHP -->(.*)<!-- PHP -->/iu", $myTemplate, $phpcodes);
    foreach($phpcodes as $code)
    {
    eval($code);
    }
     
    G3n3s!s, Feb 26, 2011 IP
  5. Vanditneel

    Vanditneel Active Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #5
    I simply want create a visitor counter & so want to use php code in my html webpage...
    Can you show me the way how to do it?
     
    Vanditneel, Feb 28, 2011 IP
  6. definitely

    definitely Well-Known Member

    Messages:
    520
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    160
    #6
    Simple... just create <img src="view.php?name=image.gif"/>
    And code your php into view.php, also you can display the current stats in your image, or if you want it to remain anonymous, you can simply make the image as a spacer.

    Regards
    Sunny Gupta
     
    definitely, Feb 28, 2011 IP
  7. Vanditneel

    Vanditneel Active Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #7
    @sunny: I am not able to understand clearly what you are tellin... can u pls elaborate?
     
    Vanditneel, Feb 28, 2011 IP
  8. lowridertj

    lowridertj Well-Known Member

    Messages:
    2,882
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    195
    #8
    include the php file using javascript for the file include.
    for use in the html file
     
    lowridertj, Feb 28, 2011 IP
  9. themullet

    themullet Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #9
    <iframe src="http://www.example.com/example.php"></iframe>
    Code (markup):
    should do the trick if you are wanting to do what I think you are
     
    themullet, Feb 28, 2011 IP
  10. lovelycesar

    lovelycesar Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Or you can use JavaScript to put content of PHP file into HTML. This refers you to Ajax or DHTML.
     
    lovelycesar, Mar 7, 2011 IP
  11. awood969

    awood969 Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    40
    #11
    I think want you want is an apache mod called mod_rewrite.

    This allows you to call .php files with dynamic URI's and spit them out as a "static HTML page".

    mod_rewrite will pick up the link somesite.com/blog/2011/03/07/BlogPost.html and know to convert it to somesite.com/blog.php?name=BlogPost or something like that.

    It's quiet powerful I would recommend it. But there is no way for HTML to call any other languages, HTML is nothing more then a series of tags that the browser parses through the decorate the page.
     
    awood969, Mar 7, 2011 IP
  12. property

    property Peon

    Messages:
    134
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    IIS server is not used for php and you can use xampp or lamp or wamp to run php files
    converting html files into php are simply change name of file as example.php
     
    property, Mar 7, 2011 IP