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 #185146 is a reply to message #185145] Sun, 02 March 2014 18:10 Go to previous messageGo to previous message
adrian is currently offline  adrian
Messages: 27
Registered: December 2012
Karma:
Junior Member
Arno Welzel <usenet(at)arnowelzel(dot)de> wrote:

> Adrian Tuddenham, 2014-02-10 21:24:
>
>> 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.
>
> PHP is only executed on the *server*. Any PHP which is "dynamically"
> added as output will *not* be executed at all.
>
> Example - if you have a file "test.php" and request it using the browser
> via http://mydomain.example/test.php:
>
> <?php
> echo "Test";
> ?>
>
> This will just output "Test".
>
> BUT: If the same will adds additional PHP code it will just be sent to
> the browser without any interpetation by the PHP runtime:
>
> <?php
> echo "echo \"My embedded test\";";
> ?>
>
> If you really need to execute "dynamic" PHP, you have to use eval(),
> which executes the code passed as parameter:
>
> <?php
> $mycode = "echo \"My embedded test\";";
>
> eval($mycode);
> ?>
>
> Even though this may work - the problem with eval() is, that it is
> horrible to debug. You don't have just a script but a script generating
> another script which will then be executed.
>
> I recommend to think about what you want to solve and if it is really
> neccessary to create "dyanamic" PHP on the fly.

I've now solved the problem a different way which avoids this
difficulty.

Thanks to all who helped.


--
~ Adrian Tuddenham ~
(Remove the ".invalid"s and add ".co.uk" to reply)
www.poppyrecords.co.uk
[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: Thu Nov 28 22:31:05 GMT 2024

Total time taken to generate the page: 0.04167 seconds