Forum Moderators: coopster

Message Too Old, No Replies

include a .php file - parsing problem?

         

mealybar

10:26 pm on May 15, 2006 (gmt 0)

10+ Year Member



Hi,
I want to be able to include 'functionsfile.php' from within my 'frontend.php' page. I've had problems with when including before as the when including the parser drops into html mode, so my includes have always been plain text files with <?php?> braces which has worked fine.

However thats a risky think having plain text php on my server, I want to have them so that if someone tries to look at the include file it parses as php [functions = nothing shows up :)].

I include 'functionsfile.php' (same file as the plain text ones but with the different extension) but the file either isnt included or the functions are not being read.

How does changing from .inc to .php for an include, break it? Is it problem with it parsing it wrongly again?

Tried numerous things to get it working, is there something I'm overlooking?

Richard

eelixduppy

10:30 pm on May 15, 2006 (gmt 0)



If the file that you include is a php file, then when someone accesses it it will show what it is supposed to show, not the php script as plain text. As long as you add the include() line before any of the function calls that come from that script, it should work perfectly fine.

eelix

mealybar

10:50 pm on May 15, 2006 (gmt 0)

10+ Year Member



What I mean is my new files are .php so that nothing is shown up if someone views the file. The plain text file is what I'm tring to get away from.

The problem is the very same included file with a php extension doesnt work! I havent changed anything but the extension.

My frontend file starts

<?php
/* some comments about the file
some more
++ */
//include functions
include 'http://...../functionsfile.php';

so nothing is before it. Thats whats puzzeling me! :(

coopster

12:15 am on May 16, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




but the file either isnt included or the functions are not being read.

I would start here. Determine whether or not the file is being included. Are you trying to include [php.net] from inside a function and losing scope?