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 #185155 is a reply to message #185145] Mon, 03 March 2014 11:38 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 02/03/14 14:54, Arno Welzel 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.
>
it ain't that bad: the errors show up as error in eval script called on
line X: error in evalled script on line Y

So you at least know what the errors is and where it is.

Gets more interesting if your evalled script also evals more script..


> I recommend to think about what you want to solve and if it is really
> neccessary to create "dyanamic" PHP on the fly.
>
Nice thing about evalled code is that you can stick it in a database..

>
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
[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:48:15 GMT 2024

Total time taken to generate the page: 0.04732 seconds