Using PHP and ASP in a single source file?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan S

    Using PHP and ASP in a single source file?

    I'm a software engineer but pretty naive about web programming/scripting.
    I'm working with a server running Windows IIS. I have several ASP files and
    several PHP
    files (not developed by me) that all work fine on the server. There's a
    little ASP that's to be put at the top of every page, which of course works
    fine for the .ASP pages. Now, if I want
    to include this same snippet of ASP code at the top of one of the PHP files,
    is that possible?
    If so, what would the extension of the "mainly PHP" file be? If the
    extension is PHP, the ASP won't be recognized, and vice-versa. That's what
    I'm experiencing anyway.

    Thanks,

    Dan





  • gorf

    #2
    Re: Using PHP and ASP in a single source file?

    "Dan S" <dansydow@sbcgl obal.net> wrote in message
    news:blcf7i$ala 9j$1@ID-207392.news.uni-berlin.de...[color=blue]
    > I'm a software engineer but pretty naive about web programming/scripting.
    > I'm working with a server running Windows IIS. I have several ASP files[/color]
    and[color=blue]
    > several PHP
    > files (not developed by me) that all work fine on the server. There's a
    > little ASP that's to be put at the top of every page, which of course[/color]
    works[color=blue]
    > fine for the .ASP pages. Now, if I want
    > to include this same snippet of ASP code at the top of one of the PHP[/color]
    files,[color=blue]
    > is that possible?
    > If so, what would the extension of the "mainly PHP" file be? If the
    > extension is PHP, the ASP won't be recognized, and vice-versa. That's what
    > I'm experiencing anyway.[/color]

    The way I understand it, a file's extension tells IIS to use a particular
    DLL when working with a file. Unless you have a DLL that reads both ASP and
    PHP, I doubt that you can do this. I don't think such a DLL exists either.

    My suggestion is to find out which code is easier to convert to the other,
    and settle with either PHP or ASP.

    --
    gorf


    Comment

    • TJS

      #3
      Re: Using PHP and ASP in a single source file?

      it's one or the other, bu tnot both.

      PHP can use COM, so you could put the snippet into a component then it could
      be used by both PHP and ASP


      --
      =============== =============== ==

      A Resource Site for Web Developers
      *Free OnLine web Tools
      *Free development services
      =============== =============== ==



      "Dan S" <dansydow@sbcgl obal.net> wrote in message
      news:blcf7i$ala 9j$1@ID-207392.news.uni-berlin.de...[color=blue]
      > I'm a software engineer but pretty naive about web programming/scripting.
      > I'm working with a server running Windows IIS. I have several ASP files[/color]
      and[color=blue]
      > several PHP
      > files (not developed by me) that all work fine on the server. There's a
      > little ASP that's to be put at the top of every page, which of course[/color]
      works[color=blue]
      > fine for the .ASP pages. Now, if I want
      > to include this same snippet of ASP code at the top of one of the PHP[/color]
      files,[color=blue]
      > is that possible?
      > If so, what would the extension of the "mainly PHP" file be? If the
      > extension is PHP, the ASP won't be recognized, and vice-versa. That's what
      > I'm experiencing anyway.
      >
      > Thanks,
      >
      > Dan
      >
      >
      >
      >
      >[/color]


      Comment

      • Paulus Magnus

        #4
        Re: Using PHP and ASP in a single source file?


        "gorf" <ask@for.it> wrote in message
        news:blcmc6$adg $1@geraldo.cc.u texas.edu...[color=blue]
        > "Dan S" <dansydow@sbcgl obal.net> wrote in message
        > news:blcf7i$ala 9j$1@ID-207392.news.uni-berlin.de...[color=green]
        > > I'm a software engineer but pretty naive about web[/color][/color]
        programming/scripting.[color=blue][color=green]
        > > I'm working with a server running Windows IIS. I have several ASP files[/color]
        > and[color=green]
        > > several PHP
        > > files (not developed by me) that all work fine on the server. There's a
        > > little ASP that's to be put at the top of every page, which of course[/color]
        > works[color=green]
        > > fine for the .ASP pages. Now, if I want
        > > to include this same snippet of ASP code at the top of one of the PHP[/color]
        > files,[color=green]
        > > is that possible?
        > > If so, what would the extension of the "mainly PHP" file be? If the
        > > extension is PHP, the ASP won't be recognized, and vice-versa. That's[/color][/color]
        what[color=blue][color=green]
        > > I'm experiencing anyway.[/color]
        >
        > The way I understand it, a file's extension tells IIS to use a particular
        > DLL when working with a file. Unless you have a DLL that reads both ASP[/color]
        and[color=blue]
        > PHP, I doubt that you can do this. I don't think such a DLL exists[/color]
        either.[color=blue]
        >
        > My suggestion is to find out which code is easier to convert to the other,
        > and settle with either PHP or ASP.
        >
        > --
        > gorf
        >[/color]

        You could always use one system to read the other page. For example, if
        index.php needed something out of index.asp. You'd have a block of code in
        index.php that used file() to read http://yourserver.com/index.asp and then
        used a preg_match to hack the resulting bit of HTML from index.asp and then
        you could just echo that block wherever you wanted it to appear. If you
        placed some HTML comment strings around the bit of ASP you wanted to hack it
        would make the whole snipping job a lot easier.

        For instance,

        <?
        $file = file_get_conten ts ("http://yourserver.com/index.asp");
        preg_match ("/<!--{SNIP HERE}-->(.*?)<!--{STOP SNIPPING}-->/s", $file,
        $matches);
        echo ($matches[1]);
        ?>

        ^^ Note: Untested code ^^

        It's a bit of a kludge and results in two pages running through your IIS but
        it may be a workaround for your duality issue for the moment.

        Paul


        Comment

        • Manitoba98

          #5
          Re: Using PHP and ASP in a single source file?

          Or you could just use an <iframe>...
          "Paulus Magnus" <paulus.magnus@ loves-spam.com> wrote in message
          news:bld9tq$qjd $1@sparta.btint ernet.com...[color=blue]
          >
          > "gorf" <ask@for.it> wrote in message
          > news:blcmc6$adg $1@geraldo.cc.u texas.edu...[color=green]
          > > "Dan S" <dansydow@sbcgl obal.net> wrote in message
          > > news:blcf7i$ala 9j$1@ID-207392.news.uni-berlin.de...[color=darkred]
          > > > I'm a software engineer but pretty naive about web[/color][/color]
          > programming/scripting.[color=green][color=darkred]
          > > > I'm working with a server running Windows IIS. I have several ASP[/color][/color][/color]
          files[color=blue][color=green]
          > > and[color=darkred]
          > > > several PHP
          > > > files (not developed by me) that all work fine on the server. There's[/color][/color][/color]
          a[color=blue][color=green][color=darkred]
          > > > little ASP that's to be put at the top of every page, which of course[/color]
          > > works[color=darkred]
          > > > fine for the .ASP pages. Now, if I want
          > > > to include this same snippet of ASP code at the top of one of the PHP[/color]
          > > files,[color=darkred]
          > > > is that possible?
          > > > If so, what would the extension of the "mainly PHP" file be? If the
          > > > extension is PHP, the ASP won't be recognized, and vice-versa. That's[/color][/color]
          > what[color=green][color=darkred]
          > > > I'm experiencing anyway.[/color]
          > >
          > > The way I understand it, a file's extension tells IIS to use a[/color][/color]
          particular[color=blue][color=green]
          > > DLL when working with a file. Unless you have a DLL that reads both ASP[/color]
          > and[color=green]
          > > PHP, I doubt that you can do this. I don't think such a DLL exists[/color]
          > either.[color=green]
          > >
          > > My suggestion is to find out which code is easier to convert to the[/color][/color]
          other,[color=blue][color=green]
          > > and settle with either PHP or ASP.
          > >
          > > --
          > > gorf
          > >[/color]
          >
          > You could always use one system to read the other page. For example, if
          > index.php needed something out of index.asp. You'd have a block of code in
          > index.php that used file() to read http://yourserver.com/index.asp and[/color]
          then[color=blue]
          > used a preg_match to hack the resulting bit of HTML from index.asp and[/color]
          then[color=blue]
          > you could just echo that block wherever you wanted it to appear. If you
          > placed some HTML comment strings around the bit of ASP you wanted to hack[/color]
          it[color=blue]
          > would make the whole snipping job a lot easier.
          >
          > For instance,
          >
          > <?
          > $file = file_get_conten ts ("http://yourserver.com/index.asp");
          > preg_match ("/<!--{SNIP HERE}-->(.*?)<!--{STOP SNIPPING}-->/s", $file,
          > $matches);
          > echo ($matches[1]);
          > ?>
          >
          > ^^ Note: Untested code ^^
          >
          > It's a bit of a kludge and results in two pages running through your IIS[/color]
          but[color=blue]
          > it may be a workaround for your duality issue for the moment.
          >
          > Paul
          >
          >[/color]


          Comment

          Working...