Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php scripts wont work
Old 02-29-2008, 08:13 PM php scripts wont work
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
in my project, i have a template file called index.php this file has got a script in it that is <?php title(); ?> . the index file gets the source of this file and outputs it to the browser. the design is alright but its not parsing the php script. how do i fix it and why is it happening?
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-29-2008, 08:17 PM Re: php scripts wont work
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
Maybe it's because it's Friday! but I need a little more info. Are you getting an error? If not, turn debugging on in PHP and turn on error reporting. Sorry, can't remember to code to do that off hand.

Can you provide more code?
joder is offline
Reply With Quote
View Public Profile
 
Old 02-29-2008, 08:29 PM Re: php scripts wont work
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I think your problem is that you try to access the page without passing by a php enabled web server.

PHP is a server side scripting language. This means that the PHP engine must analyze the .php page, and replace the instructions in it with the result these instructions generate on the server before sending the modified page to the browser.

If you access the page without passing through a server, or that the server has no PHP support, you will see the PHP script, as it will not be replaced.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 03-01-2008, 07:07 AM Re: php scripts wont work
Novice Talker

Posts: 8
Name: Umakant Patil
Trades: 0
can u paste the script here.. so we can see it
__________________

Please login or register to view this content. Registration is FREE
||
Please login or register to view this content. Registration is FREE
||
Please login or register to view this content. Registration is FREE
frendzforum is offline
Reply With Quote
View Public Profile Visit frendzforum's homepage!
 
Old 03-01-2008, 07:34 AM Re: php scripts wont work
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
the function prototype to output the page is:
PHP Code:
 function DisplayPage$page )
 {
  
//get file contents
  
$source file_get_contents($page.'.php');
  
//echo the template file
  
print $source;
 } 
and the template file called index.php is:

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php intro(); ?></title>
I've only giving a snippet because this is the actual part thats the problem
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE

Last edited by andyp; 03-01-2008 at 07:35 AM..
andyp is offline
Reply With Quote
View Public Profile
 
Old 03-01-2008, 10:29 AM Re: php scripts wont work
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
With the code you supplied, I don't see anything in one that references the other.
joder is offline
Reply With Quote
View Public Profile
 
Old 03-01-2008, 10:51 AM Re: php scripts wont work
dlaroche22's Avatar
Skilled Talker

Posts: 84
Name: Dustin Laroche
Trades: 0
I see what you are trying to do. From the looks of it when you get the file contents and print them the calling function is printing the .php file as text, because its not getting parsed before being printed. I would look into PECL tidy, because it had functions for parsing text and HTML. I hope this helps some what and points you in the right direction.
__________________
Under Construction, But A Work In Progress
Webhosting isn't cheap, sponsors are important

Please login or register to view this content. Registration is FREE
dlaroche22 is offline
Reply With Quote
View Public Profile
 
Old 03-01-2008, 01:42 PM Re: php scripts wont work
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
I would look into PECL tidy
No, Tidy is here to correct invalid html into a valid one.

What he needs to do is an include() or a require(). This will interpret the PHP code.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 03-01-2008, 01:44 PM Re: php scripts wont work
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
Thanks
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to php scripts wont work
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49104 seconds with 12 queries