FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Nested PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Nested PHP [message #184829 is a reply to message #184823] Mon, 10 February 2014 23:06 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Mon, 10 Feb 2014 21:44:02 +0000, Adrian Tuddenham wrote:

> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>
>> On 2/10/2014 3:24 PM, Adrian Tuddenham wrote:
>>> I am using a php program to generate and download a webpage as an
>>> HTML file, the HTML file draws its headers and navigation bar from
>>> another HTML file using some embedded php with an "include" command.
>>>
>>> The embedded php doesn't run when the file is downloaded, so the page
>>> appears in the browser without its headers or navigation.
>>>
>>> Is there a way of making the HTML file run the php or do I have to
>>> tackle this from another angle?

>> The PHP code in your generated file is only executed when the file is
>> processed as a web page. This is done by the web server, based on the
>> file extension (default is .php; you do have that as the file
>> extension,
>> right?).

> Yes - and the same code runs perfectly well with all its headers if the
> file is sitting on the server and I call it up with a browser. It is
> only if I 'create' it on the fly from a php program that it doesn't work
> - the HTML runs but the php doesn't.

What happens is that php script is executed by a script processor in the
server, and the output of the php script is delivered by the server as
html.

>> Any other means of downloading the file (i.e. ftp) will not cause the
>> PHP code to be executed.

> I was using a browser to view it, but the source code was coming from a
> php program, not directly from a file on the server.

When you say "the source code was coming from a php program" do you mean
that you were viewing a php script with a web browser, or do you mean
that you were running a script through a php interpreter and viewing the
output?

Any php processing for web pages that is needed is generally carried out
in a process called from the main server process in the web server.
Normally when a .php file is requested, the webserver passes the file to
the php processor, and takes the output of the php processor and sends
that to the requesting client as html (unless another content type is
specified).

It's also possible for php to be embedded in html files, in which case
the same thing happens for html files.

I can't quite map your description of what you're doing and what you seem
to expect with my knowledge of how web servers work, this suggests that
either you're using the terminology in a way that I don't understand, or
possibly that your perception of what is happening is not what is
actually happening.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Filling an array with random input doesn't quite work
Next Topic: string length
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 00:28:09 GMT 2024

Total time taken to generate the page: 0.05234 seconds