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

Home » Imported messages » comp.lang.php » PHP Always Outputs
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP Always Outputs [message #178635 is a reply to message #178633] Sat, 14 July 2012 20:12 Go to previous messageGo to previous message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma:
Senior Member
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote in
news:jtsfl7$rqo$1(at)dont-email(dot)me:

> On 7/14/2012 10:40 AM, Doug Miller wrote:
>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote in
>> news:jtrt6u$ccj$1(at)dont-email(dot)me:
>>
>>> On 7/14/2012 9:37 AM, Doug Miller wrote:
>>>> Ryan <rbilesky(at)gmail(dot)com> wrote in
>>>> news:a5baa7aa-287c-4862-8ab9-898783d691f4 @googlegroups.com:
>>>>
>>>> > I want a php script to run and simply output nothing. But
>>>> > even this script:
>>>> >
>>>> > <?php
>>>> > ?>
>>>> >
>>>> > will output this html
>>>> >
>>>> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
>>>> > Transitional//EN"> <HTML><HEAD>
>>>> > <META content="text/html; charset=windows-1252"
>>>> > http-equiv=Content-Type></HEAD> <BODY></BODY></HTML>
>>>> >
>>>> > Is there a setting somewhere in my php or apache config that
>>>> > needs to be turned off?
>>>>
>>>> Check your .htaccess file -- it probably contains a line that
>>>> looks like this:
>>>>
>>>> php_value auto_prepend_file "foo.php"
>>>>
>>>> with the contents of the file foo.php resembling
>>>>
>>>> echo "!<DOCTYPE HTML PUBLIC...";
>>>> echo "<HTML><HEAD>";
>>>> etc.
>>>>
>>> If it were, it would be seriously broken.
>>
>> I disagree.
>>
>>> There would be no way
>>> to add <HEAD> tags or the <BODY> in their proper places.
>>
>> Of course there is. I have reproduced the OP's results
>> *exactly* with the following:
>>
>> C:\WebSites\fubar>type .htaccess
>> php_value auto_prepend_file "prepend.php"
>> php_value auto_append_file "append.txt"
>>
>>
>> C:\WebSites\fubar>type prepend.php
>> <?php
>> printf ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
>> Transitional//EN\">\n"); printf ("<HTML><HEAD>\n");
>> printf ("<META content=\"text/html; charset=windows-1252\"
>> http-equiv=Content-Type> </HEAD>\n");
>> printf ("<BODY>");
>> ?>
>>
>> C:\WebSites\fubar>type append.txt
>> </BODY></HTML>
>>
>> Content of the OP's pages will be served between the <BODY> and
>> </BODY> tags. If he wants to be able to add tags in the HEAD
>> section as well, it's simple enough to insert readfile
>> ("head_tags.txt") into the file prepend.php somewhere between
>> <HEAD> and <\HEAD>, putting the desired tags into
>> head_tags.txt.
>>
>
> Now, how is the user supposed to place other <HEAD> tags such as
> <TITLE>, <SCRIPT> and <LINK>? The answer is, he can't.

Ummmm, yes, he can. I just described how that can be done.

> And while he
> *could* put a readfile() in there, it would be no different than
> placing the tags directly in the file. He couldn't customize
> the tags to the page.

I didn't say that the tags could be customized. But you *did* say
they couldn't be inserted at all. Which they obviously can.
>
> While what you say *could* be used - it would result in a
> seriously broken site with the inability to add such tags.

Again -- there is no such "inability to add" tags in the HEAD
section. OK, they can't be customized. But let's back up a few
paragraphs, to where you said "there would be no way" to add them.
Of course there is.

> Also, there would be no need to use printf() there. Just the
> HTML code itself would be fine.

If the prepended file is just HTML code, not a PHP script, then
it's not possible to use readfile() to insert any head tags that
may be desired.
[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
Previous Topic: Business Developer for IT company
Next Topic: decode encoded url
Goto Forum:
  

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

Current Time: Sun Oct 20 08:09:57 GMT 2024

Total time taken to generate the page: 0.04102 seconds