PHP in html

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

    PHP in html

    Hello,


    I have a php include command in my website and the script shows up.


    However, I need for the script to show up on the right side of page
    (there is enough room there)... but for some reason it shows up at the
    bottom. I placed the include command in the correct part of my html
    file. Is there any way to give some sort of command on where you want
    it to show up on the webpage?



  • Michael Fesser

    #2
    Re: PHP in html

    ..oO(John)
    >I have a php include command in my website and the script shows up.
    >
    >However, I need for the script to show up on the right side of page
    >(there is enough room there)... but for some reason it shows up at the
    >bottom. I placed the include command in the correct part of my html
    >file. Is there any way to give some sort of command on where you want
    >it to show up on the webpage?
    Sure, but that's a HTML/CSS issue and has nothing to do with PHP itself.

    Micha

    Comment

    • FFMG

      #3
      Re: PHP in html


      John;83532 Wrote:
      Hello,
      >
      >
      I have a php include command in my website and the script shows up.
      >
      >
      However, I need for the script to show up on the right side of page
      (there is enough room there)... but for some reason it shows up at the
      bottom. I placed the include command in the correct part of my html
      file. Is there any way to give some sort of command on where you want
      it to show up on the webpage?
      I don't think it has anything to do with PHP really.
      It probably has more to do with the HTML/CSS code.

      But without seeing any code it is impossible to even guess what the
      problem could be.

      You will need to post the code, (HTML not the PHP), so we can tell as
      to why the display is the way it is.

      FFMG


      --

      'webmaster forum' (http://www.httppoint.com) | 'webmaster Directory'
      (http://www.webhostshunter.com/) | 'Recreation Vehicle insurance'
      (http://www.insurance-owl.com/other/car_rec.php)
      'Free URL redirection service' (http://urlkick.com/)
      ------------------------------------------------------------------------
      FFMG's Profile: http://www.httppoint.com/member.php?userid=580
      View this thread: http://www.httppoint.com/showthread.php?t=18816

      Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

      Comment

      • Captain Paralytic

        #4
        Re: PHP in html

        On 27 Jul, 06:10, John <John_nos...@nn nnnnnnn.nowhere wrote:
        Hello,
        >
        I have a php include command in my website and the script shows up.
        >
        However, I need for the script to show up on the right side of page
        (there is enough room there)... but for some reason it shows up at the
        bottom. I placed the include command in the correct part of my html
        file. Is there any way to give some sort of command on where you want
        it to show up on the webpage?
        A php include has to go in a php file.

        HTML includes are normally done using SSI.

        If you are using HTL includes then you are asking in totally the wrong
        place.

        Comment

        • John

          #5
          Re: PHP in html

          On Fri, 27 Jul 2007 02:02:52 -0700, Captain Paralytic
          <paul_lautman@y ahoo.comwrote:
          >
          >A php include has to go in a php file.
          >
          >HTML includes are normally done using SSI.
          >
          >If you are using HTL includes then you are asking in totally the wrong
          >place.


          That is incorrect.


          You can have php includes in a html file.

          Comment

          • Captain Paralytic

            #6
            Re: PHP in html

            On 27 Jul, 15:58, John <John_nos...@nn nnnnnnn.nowhere wrote:
            On Fri, 27 Jul 2007 02:02:52 -0700, Captain Paralytic
            >
            <paul_laut...@y ahoo.comwrote:
            >
            A php include has to go in a php file.
            >
            HTML includes are normally done using SSI.
            >
            If you are using HTL includes then you are asking in totally the wrong
            place.
            >
            That is incorrect.
            >
            You can have php includes in a html file.
            How does that work?

            a php include must be in a file that will be interpreted by the php
            interpreter. The file extension may be .HTML, but the file will be a
            php file by virtue of having the include() within php tags and the web
            server will have been told that this type of file is a php file.

            A php include() within a file that contains pure html and no php tags
            will AFAIAA not do anything.

            Comment

            • Anonymous

              #7
              Re: PHP in html

              John wrote:
              A php include has to go in a php file.

              HTML includes are normally done using SSI.

              If you are using HTL includes then you are asking in totally the wrong
              place.
              >
              That is incorrect.
              >
              You can have php includes in a html file.
              In theory, yes. In practice, no. Because most webservers are not
              configured to parse a .html file through PHP.

              If the filename does not end in .php (.php5 or other widely accepted
              extension which denotes a PHP file) it won't be parsed and the PHP
              include won't get executed.

              Sure, if you have total control of the webserver you can tell it to
              parse every file through PHP but this is considered bad practice as it
              will slow down the server.

              Bye!

              Comment

              • Matt S

                #8
                Re: PHP in html

                Captain Paralytic wrote:
                On 27 Jul, 15:58, John <John_nos...@nn nnnnnnn.nowhere wrote:
                >On Fri, 27 Jul 2007 02:02:52 -0700, Captain Paralytic
                >>
                ><paul_laut...@ yahoo.comwrote:
                >>
                >A php include has to go in a php file.
                >>
                >HTML includes are normally done using SSI.
                >>
                >If you are using HTL includes then you are asking in totally the wrong
                >place.
                >>
                >That is incorrect.
                >>
                >You can have php includes in a html file.
                >
                How does that work?
                AddType application/x-httpd-php .html
                For Apache of course. You just force the MIME type of .html files to be PHP
                files. If you're using an executable directory so to say (+ExecCGI), you
                could just put #!/usr/bin/env php at the top and it would be treated as a
                PHP file regardless of file extension.
                --
                'Yes, firefox is indeed greater than women. Can women block pops up for you?
                No. Can Firefox show you naked women? Yes.'

                Comment

                • Jerry Stuckle

                  #9
                  Re: PHP in html

                  Matt S wrote:
                  Captain Paralytic wrote:
                  >
                  >On 27 Jul, 15:58, John <John_nos...@nn nnnnnnn.nowhere wrote:
                  >>On Fri, 27 Jul 2007 02:02:52 -0700, Captain Paralytic
                  >>>
                  >><paul_laut... @yahoo.comwrote :
                  >>>
                  >>>A php include has to go in a php file.
                  >>>HTML includes are normally done using SSI.
                  >>>If you are using HTL includes then you are asking in totally the wrong
                  >>>place.
                  >>That is incorrect.
                  >>>
                  >>You can have php includes in a html file.
                  >How does that work?
                  AddType application/x-httpd-php .html
                  For Apache of course. You just force the MIME type of .html files to be PHP
                  files. If you're using an executable directory so to say (+ExecCGI), you
                  could just put #!/usr/bin/env php at the top and it would be treated as a
                  PHP file regardless of file extension.
                  And waste a hell of a lot of server resources parsing your static HTML
                  files for PHP.

                  Thank &Diety most shared hosting environments don't allow this. What a
                  bunch of crappola.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • Michael Fesser

                    #10
                    Re: PHP in html

                    ..oO(Jerry Stuckle)
                    >Matt S wrote:
                    >
                    >For Apache of course. You just force the MIME type of .html files to be PHP
                    >files. If you're using an executable directory so to say (+ExecCGI), you
                    >could just put #!/usr/bin/env php at the top and it would be treated as a
                    >PHP file regardless of file extension.
                    >
                    >And waste a hell of a lot of server resources parsing your static HTML
                    >files for PHP.
                    * using .htaccess you can enable that on a per-directory basis
                    * if you're using PHP for more than just a form on a single page, then
                    it doesn't matter, because all pages have to be parsed anyway
                    * the file extension .html (or no extension at all) is preferred for
                    stable URIs
                    >Thank &Diety most shared hosting environments don't allow this. What a
                    >bunch of crappola.
                    Not if done properly.

                    Micha

                    Comment

                    • Jerry Stuckle

                      #11
                      Re: PHP in html

                      Michael Fesser wrote:
                      .oO(Jerry Stuckle)
                      >
                      >Matt S wrote:
                      >>
                      >>For Apache of course. You just force the MIME type of .html files to be PHP
                      >>files. If you're using an executable directory so to say (+ExecCGI), you
                      >>could just put #!/usr/bin/env php at the top and it would be treated as a
                      >>PHP file regardless of file extension.
                      >And waste a hell of a lot of server resources parsing your static HTML
                      >files for PHP.
                      >
                      * using .htaccess you can enable that on a per-directory basis
                      So? It's still a waste of resources.
                      * if you're using PHP for more than just a form on a single page, then
                      it doesn't matter, because all pages have to be parsed anyway
                      Only if they contain php code.
                      * the file extension .html (or no extension at all) is preferred for
                      stable URIs
                      >
                      That's your opinion, anyway.
                      >Thank &Diety most shared hosting environments don't allow this. What a
                      >bunch of crappola.
                      >
                      Not if done properly.
                      >
                      Micha
                      If you have any static html pages on your site, you are wasting resources.

                      It's exactly WHY Apache doesn't by default parse everything with PHP,
                      PERL, and everything else on the market.

                      --
                      =============== ===
                      Remove the "x" from my email address
                      Jerry Stuckle
                      JDS Computer Training Corp.
                      jstucklex@attgl obal.net
                      =============== ===

                      Comment

                      • Michael Fesser

                        #12
                        Re: PHP in html

                        ..oO(Jerry Stuckle)
                        >Michael Fesser wrote:
                        >>
                        >* using .htaccess you can enable that on a per-directory basis
                        >
                        >So? It's still a waste of resources.
                        Like storing images in a database for example. Who's wasting resources
                        then?
                        >* if you're using PHP for more than just a form on a single page, then
                        > it doesn't matter, because all pages have to be parsed anyway
                        >
                        >Only if they contain php code.
                        As said, "if you're using PHP for more than just a form on a single
                        page", then it's very likely that all pages contain PHP code, even if
                        it's just an include of a menu bar script.
                        >* the file extension .html (or no extension at all) is preferred for
                        > stable URIs
                        >
                        >That's your opinion, anyway.
                        Not only mine. It's also the W3C's opinion.

                        Micha

                        Comment

                        • Jerry Stuckle

                          #13
                          Re: PHP in html

                          Michael Fesser wrote:
                          .oO(Jerry Stuckle)
                          >
                          >Michael Fesser wrote:
                          >>* using .htaccess you can enable that on a per-directory basis
                          >So? It's still a waste of resources.
                          >
                          Like storing images in a database for example. Who's wasting resources
                          then?
                          >
                          Not at all. Databases are quite efficient at retrieving data -
                          including images.
                          >>* if you're using PHP for more than just a form on a single page, then
                          >> it doesn't matter, because all pages have to be parsed anyway
                          >Only if they contain php code.
                          >
                          As said, "if you're using PHP for more than just a form on a single
                          page", then it's very likely that all pages contain PHP code, even if
                          it's just an include of a menu bar script.
                          >
                          Nope. Not at all. I have several sites with some pages which have no
                          PHP in them at all. And if they have a menu bar script, they're
                          included with SSI.
                          >>* the file extension .html (or no extension at all) is preferred for
                          >> stable URIs
                          >That's your opinion, anyway.
                          >
                          Not only mine. It's also the W3C's opinion.
                          >
                          Micha
                          Exactly where do they say that? And where do they say they've taken
                          over programming and support for Apache, IIS, and other web servers?


                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstucklex@attgl obal.net
                          =============== ===

                          Comment

                          • Michael Fesser

                            #14
                            Re: PHP in html

                            ..oO(Jerry Stuckle)
                            >Of course, you conveniently ignore the fact those 20 images require 20
                            >additional calls to the server, anyway.
                            Doesn't matter here. 20 requests are 20 requests, but it makes a big
                            difference if the server can deliver them statically as-is or if it has
                            to invoke a script handler for every single image.
                            >The script will already be in
                            >memory (if nothing else, the OS cache will have it),
                            Page-generating scripts can be cached as well, dependent on the
                            configuration of the webserver and the PHP interpreter.
                            >and the overhead of
                            >interpreting it isn't very bad at all.
                            So you want to tell me that a simple page-generating script wastes more
                            resources then a script that has to

                            * open a connection to a database
                            * query the DB (requires to analyze and optimize the query)
                            * transfer binary data from the DB into the script
                            * close the connection
                            * transfer the data to the webserver

                            ?
                            And it beats trying to keep
                            >track of thousands (or tens of thousands) of files on the disk.
                            Doesn't matter here. We were talking about performance and "wasting a
                            hell of a lot" resources. If you think interpreting all pages as PHP
                            wastes that many resources, but fetching images from the DB does not,
                            then there must be something really wrong ...
                            >Not nearly as much as PHP.
                            Depends on the server configuration I would say. SSI requires a parser/
                            interpreter as well. And PHP running as a server module is quite fast.
                            The work that has to be done by the parsers is quite the same - they
                            just look for special directives in the HTML code.
                            >But I didn't say I used SSI on all pages,
                            >either, did I?
                            Well, using SSI for a menu indicates that.
                            >They say URI's don't change. They don't say to interpret every page as PHP.
                            Again: This wasn't the point here. We were talking about leaving out
                            file extensions from a URL.

                            Micha

                            Comment

                            • Jerry Stuckle

                              #15
                              Re: PHP in html

                              Michael Fesser wrote:
                              .oO(Jerry Stuckle)
                              >
                              >Of course, you conveniently ignore the fact those 20 images require 20
                              >additional calls to the server, anyway.
                              >
                              Doesn't matter here. 20 requests are 20 requests, but it makes a big
                              difference if the server can deliver them statically as-is or if it has
                              to invoke a script handler for every single image.
                              >
                              Not nearly as much as you claim.
                              >The script will already be in
                              >memory (if nothing else, the OS cache will have it),
                              >
                              Page-generating scripts can be cached as well, dependent on the
                              configuration of the webserver and the PHP interpreter.
                              >
                              Sure they can. But they still have to be interpreted unnecessarily.
                              >and the overhead of
                              >interpreting it isn't very bad at all.
                              >
                              So you want to tell me that a simple page-generating script wastes more
                              resources then a script that has to
                              >
                              * open a connection to a database
                              * query the DB (requires to analyze and optimize the query)
                              * transfer binary data from the DB into the script
                              * close the connection
                              * transfer the data to the webserver
                              >
                              ?
                              >
                              This isn't part of the discussion. There are other reasons for
                              delivering images from the database.
                              > And it beats trying to keep
                              >track of thousands (or tens of thousands) of files on the disk.
                              >
                              Doesn't matter here. We were talking about performance and "wasting a
                              hell of a lot" resources. If you think interpreting all pages as PHP
                              wastes that many resources, but fetching images from the DB does not,
                              then there must be something really wrong ...
                              >
                              If it doesn't matter, then why did you bring it up?
                              >Not nearly as much as PHP.
                              >
                              Depends on the server configuration I would say. SSI requires a parser/
                              interpreter as well. And PHP running as a server module is quite fast.
                              The work that has to be done by the parsers is quite the same - they
                              just look for special directives in the HTML code.
                              >
                              You obviously don't understand how it works. The SSI parser is much
                              smaller and much faster than the PHP parser.
                              >But I didn't say I used SSI on all pages,
                              >either, did I?
                              >
                              Well, using SSI for a menu indicates that.
                              >
                              Sure, but I didn't say it was on every page, either.
                              >They say URI's don't change. They don't say to interpret every page as PHP.
                              >
                              Again: This wasn't the point here. We were talking about leaving out
                              file extensions from a URL.
                              >
                              Micha
                              Exactly. They say don't change the URL. They don't say interpret every
                              page as PHP. There are other ways to do it.

                              --
                              =============== ===
                              Remove the "x" from my email address
                              Jerry Stuckle
                              JDS Computer Training Corp.
                              jstucklex@attgl obal.net
                              =============== ===

                              Comment

                              Working...