Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Cant get include to work...

 
   Database Forums (Home) -> PHP RSS
Next:  Parallel Scripts  
Author Message
johnwebster9865

External


Since: Jan 22, 2008
Posts: 2



(Msg. 1) Posted: Tue Jan 22, 2008 7:21 am
Post subject: Cant get include to work...
Archived from groups: comp>lang>php (more info?)

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

 >> Stay informed about: Cant get include to work... 
Back to top
Login to vote
johnwebster9865

External


Since: Jan 22, 2008
Posts: 2



(Msg. 2) Posted: Tue Jan 22, 2008 7:27 am
Post subject: Re: Cant get include to work... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I wish I could delete this message. Just figured it out. Sorry.

 >> Stay informed about: Cant get include to work... 
Back to top
Login to vote
ZeldorBlat

External


Since: Apr 17, 2007
Posts: 44



(Msg. 3) Posted: Tue Jan 22, 2008 7:28 am
Post subject: Re: Cant get include to work... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 22, 10:21 am, 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 writing {php} and {/php} in your code or is that just
for the sake of illustration?
 >> Stay informed about: Cant get include to work... 
Back to top
Login to vote
Jerry Stuckle

External


Since: Aug 11, 2004
Posts: 1367



(Msg. 4) Posted: Tue Jan 22, 2008 1:59 pm
Post subject: Re: Cant get include to work... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

johnwebster9865 wrote:
> I wish I could delete this message. Just figured it out. Sorry.
>

John,

Don't worry about it. We all were beginners at one time. And I'm sure
we've all made similar mistakes! Smile


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex.TakeThisOut@attglobal.net
==================
 >> Stay informed about: Cant get include to work... 
Back to top
Login to vote
Jeff Gaines

External


Since: Oct 08, 2007
Posts: 6



(Msg. 5) Posted: Tue Jan 22, 2008 2:03 pm
Post subject: Re: Cant get include to work... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 22/01/2008 in message

johnwebster9865 wrote:

>{php}
>print "Hello";
>{/php}
><br />This is just placeholder text

I am new to php as well but I haven't seen that terminology so far.

Shouldn't it be:

<?php
print "Hello";
?>

--
Jeff Gaines Damerham Hampshire UK
This is as bad as it can get, but don't bet on it
 >> Stay informed about: Cant get include to work... 
Back to top
Login to vote
Jensen Somers

External


Since: Jan 18, 2008
Posts: 6



(Msg. 6) Posted: Tue Jan 22, 2008 2:03 pm
Post subject: Re: Cant get include to work... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
 >> Stay informed about: Cant get include to work... 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
include within include, using a relatve path - Hi, I have noticed something in PHP's include mechanism that surprised me. If you include a script that itself contains an include command using a relative path, that path is interpreted from the position of the 'outermost' script, not that of the scrip...

php include - I like to change a site from frames to a site that uses php pages with include. But the site contains subfolders and in those subfolders are images. I want to make a page, say index.php that includes a page in the subfolder: <?php..

PHP include/require bug? - Why can't I include/require a file starting with the letter 't'? <?php require "C:\t.php"; ?> [11-Dec-2005 15:55:00] PHP Warning: main(C: .php) [<a href='function.main'>function.main</a>]: failed to open stream: Inv...

include statement - Has anyone ever experienced an issue with an include statement where the included file is processed, however, no further code is processed after the included content? I have used includes for quite a while, however, this is a new one for me. Any..

How 2 include meta tags? - Hello, I have a small website and I use the include function for the top head section of each page. This is convenient but all the pages have the same meta tags as a result. I would like to have different meta tags for each page. What it the most..
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]