TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-25-2009, 01:46 PM   #1 (permalink)
The Contributor
 
hello-world's Avatar
 
Join Date: Feb 2009
Posts: 73
Thanks: 30
hello-world is on a distinguished road
Default file_get_contents with PHP tags

Hi I want to get the contents of a html + php with file_get_contents. As I print it, it prints the php tags like simple text. How can I get the php tags as php tags. I know my question is confusing. I hope you understand it.
Thanks in Advance.
hello-world is offline  
Reply With Quote
Old 03-25-2009, 04:33 PM   #2 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

You would use include or require to read the file.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
The Following User Says Thank You to xenon For This Useful Post:
hello-world (03-29-2009)
Old 03-25-2009, 06:19 PM   #3 (permalink)
The Contributor
 
hello-world's Avatar
 
Join Date: Feb 2009
Posts: 73
Thanks: 30
hello-world is on a distinguished road
Default

actually I use have a HTML (named profil.html) file which contains php coding inside.I used file_get_contents and parse it. The php codings is turned as string not as php script.
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <link href="templates/default/stylesheet.css" rel="stylesheet" type="text/css"/></link>
        <title></title>
    </head>
    <body><div id="menu">{menu}</div>
        <div id="log">
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" accept-charset="utf-8">

    <u><?php if(in_array("fill"$Nuser->error)) echo "<font color=red>Please fill all Fields</font>"?>
    <li>Name<input type="text" name = username>    <?php if(in_array("user"$Nuser->error)) echo "<font color=red>Wrong user</font>"?><?php if(in_array("taken"$Nuser->error)) echo "<font color=red>User taken</font>"?></li>

    <li>Password<input type="text" name = password>    <?php if(!empty($NoMatchedPass)){echo "passwords didn't matched";} ?><?php if(in_array("pass"$Nuser->error)) echo "<font color=red>Wrong user</font>"?></li>
    <li>Password<input type="text" name = password1></li>
    <li>Email<input type="text" name = email> <?php if(in_array("email"$Nuser->error)) echo "<font color=red>Wrong user</font>"?></li>
    <li><input type="submit" value="Register" name="submit"></li>
    </u>
</form>
</div>
    </body>
</html>
hello-world is offline  
Reply With Quote
Old 03-27-2009, 06:17 PM   #4 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

PHP Code:
ob_start();
extract($templateVarsEXTR_PREFIX_SAME'some_prefix_');
include 
'template_file.html';
$__parsed ob_get_contents();
ob_end_clean();

echo 
$__parsed
I forcedly used include there instead of include_once, for the case in which I need to include multiple template files, but with different contents (eg.: boxes of content).
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
The Following User Says Thank You to xenon For This Useful Post:
hello-world (03-29-2009)
Old 03-30-2009, 08:32 PM   #5 (permalink)
The Contributor
 
hello-world's Avatar
 
Join Date: Feb 2009
Posts: 73
Thanks: 30
hello-world is on a distinguished road
Default

Actually I was using
this tutorial with some php tags in TBL/HTML Files. It was really hard to do that. So I just used include as you told me.
Thanks anyway
hello-world is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get PHP 5. to work? Newbie windows PHP guy DotNetTim Absolute Beginners 11 02-01-2013 11:02 AM
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
Designing a tagging system Alan @ CIT Advanced PHP Programming 4 03-10-2008 03:25 PM
what are all the subjects in php? sarmenhb General 7 01-21-2008 05:41 PM


All times are GMT. The time now is 08:27 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design