php on html?

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

    php on html?

    Can I add php code directly to an html document or is it possible to
    have an include on an html page the read a php document?
    If so how would I do it?

    Thanks
    Dave
  • Jerry Gitomer

    #2
    Re: php on html?

    Dave wrote:
    [color=blue]
    > Can I add php code directly to an html document or is it
    > possible to have an include on an html page the read a php
    > document? If so how would I do it?
    >
    > Thanks
    > Dave[/color]

    Dave,
    Why not do it the other way around? You can embed the HTML in a
    PHP file. Just build your PHP program and then add the
    following:

    echo (" <HTML file goes here> ");

    The only problem I have found doing this is that you must either
    escape any " characters or limit yourself to ' inside the echo.

    HTH
    --
    Jerry Gitomer

    Comment

    • Jamie Isaacs

      #3
      Re: php on html?

      Jerry Gitomer wrote:[color=blue]
      > Dave wrote:
      >
      >[color=green]
      >>Can I add php code directly to an html document or is it
      >>possible to have an include on an html page the read a php
      >>document? If so how would I do it?
      >>
      >>Thanks
      >>Dave[/color]
      >
      >
      > Dave,
      > Why not do it the other way around? You can embed the HTML in a
      > PHP file. Just build your PHP program and then add the
      > following:
      >
      > echo (" <HTML file goes here> ");
      >
      > The only problem I have found doing this is that you must either
      > escape any " characters or limit yourself to ' inside the echo.
      >
      > HTH[/color]

      echo '<HTML "file" goes here>';

      I would suggest using templates though. Try Smarty.

      Ahh, rookies...
      -JI

      Comment

      • Markus Ernst

        #4
        Re: php on html?

        Jamie Isaacs wrote:[color=blue]
        > Jerry Gitomer wrote:[color=green]
        >> Dave wrote:
        >>
        >>[color=darkred]
        >>> Can I add php code directly to an html document or is it
        >>> possible to have an include on an html page the read a php
        >>> document? If so how would I do it?
        >>>
        >>> Thanks
        >>> Dave[/color]
        >>
        >>
        >> Dave,
        >> Why not do it the other way around? You can embed the HTML in a
        >> PHP file. Just build your PHP program and then add the
        >> following:
        >>
        >> echo (" <HTML file goes here> ");
        >>
        >> The only problem I have found doing this is that you must either
        >> escape any " characters or limit yourself to ' inside the echo.
        >>
        >> HTH[/color]
        >
        > echo '<HTML "file" goes here>';
        >
        > I would suggest using templates though. Try Smarty.[/color]

        I suggest to read the thread:

        *Does PHP need the .php extension ?*

        just a few lines further down.

        --
        Markus


        Comment

        • Dave

          #5
          Re: php on html?

          ROOKIE!!....Abs olutely!! what is Smarty?

          The rookie in me is spewing out profusely :-D
          Dave

          [color=blue]
          >
          > echo '<HTML "file" goes here>';
          >
          > I would suggest using templates though. Try Smarty.
          >
          > Ahh, rookies...
          > -JI[/color]

          Comment

          • Dave

            #6
            Re: php on html?

            I found it


            this may be nice but it doesn't help with existing sites



            Thanks
            Rookie :-)
            I think I'll adopt the name

            Comment

            • Jamie Isaacs

              #7
              Re: php on html?

              Dave wrote:[color=blue]
              > ROOKIE!!....Abs olutely!! what is Smarty?
              >
              > The rookie in me is spewing out profusely :-D
              > Dave
              >
              >
              >[color=green]
              >>echo '<HTML "file" goes here>';
              >>
              >>I would suggest using templates though. Try Smarty.
              >>
              >>Ahh, rookies...
              >>-JI[/color][/color]


              Comment

              • Felix

                #8
                Re: php on html?

                Oh, come on, people, let's help the man!

                Including an HTML file verbatim in the output is trivial.
                simply `readfile("your file.html");' will do. According to docs,
                `include("yourf ile.html")' should have exactly the same effect,
                but I haven't tried.

                Personally, I find this approach more straightforward than
                using templates.

                From the shadows,
                Felix

                Comment

                • Matthewtung

                  #9
                  Re: php on html?


                  "Dave" <dms2@revelatio nweb.com>
                  ???????:2143e70 4.0411101151.57 54667d@posting. google.com...[color=blue]
                  >I found it
                  > http://smarty.php.net/
                  >
                  > this may be nice but it doesn't help with existing sites
                  >
                  >
                  >
                  > Thanks
                  > Rookie :-)
                  > I think I'll adopt the name[/color]

                  it can be done for changing the associate file in that directory I think is
                  htaccess or something like that..I can't remember exactly


                  Comment

                  Working...