You are here: Re: Cant get include to work... « PHP Programming Language « IT news, forums, messages
Re: Cant get include to work...

Posted by Jensen Somers on 01/22/08 15:36

johnwebster9865 wrote:
> Hi
>
> This may be easy to most of you, but as a newbiw; I'm struggling.
>
> I am bringing in an include into a php file, but cant run the commands
> within the include.
>
> As an example, Within my php page I write:
>
> {php}include("content/myinclude.php");{/php}
>
> and the contents of myinclude.php is:
>
> {php}
> print "Hello";
> {/php}
> <br />This is just placeholder text
>
> Then when I view the page in the browser I see that the include is
> being brought in but is displayed as:
>
> {php} print "Hello"; {/php}
> This is just placeholder text
>
> And the {php} doesn't execute.
>
> I have set both the include and the page it is being brought into as
> executable on the unix server it is sitting on.
>
> I am right in saying that the result should only be:
>
> Hello
> This is just placeholder text
>
> Aren't I?
>
> Many Thanks
>
> John
>

Are you actually using {php}? Because that's not valid PHP syntax.
To execute PHP you need to start the section with <?php and end it with ?>

Example:

<?php
print "Hello World!"
?>

I would guess that you have been looking at some template engine that
uses {} to mark the beginning of sections, in this case a PHP section
and when parsing the template file the code between {php} and {/php} is
handled accordingly.

- Jensen

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация