PHP html and php integration (Sorry for the vague title)

I am using php to create another .php file. I made it like so:

$file = fopen($Title . ".php" ,"w") or die("File Creation error: " . mysql_error());
$textToWrite =
&lt;?php include("Header.php") ?&gt;
//Body of the webpage
$textToWrite = htmlspecialchars($textToWrite);

fwrite($file, $textToWrite);

where $Title is a non-empty variable.

I have come to see that htmlspecialchars does the exact oposite to what I want. Instead of converting the > and the < to > and < it does the oposite. Is there any other option because puting thr <?php dirrectly gives me a php error. Thank you.



Have you tried using html_entity_decode()?

Heredocs and nowdocs let you use PHP tags as string data:

<? //PHP 5.4+
<? include("Header.php"); ?>
//Body of webpage

Try to use:

$textToWrite =
      <" . "?php include("Header.php") ?" . ">
    Body of the webpage

Need Your Help

How to change the value of format specifier at runtime?

c++ c sscanf format-specifiers

I am using sscanf in my project to copy strings from source buffer to target buffer.

Cannot drag and drop to debugged-application run from a privileged-run Visual Studio 2010

visual-studio-2010 drag-and-drop privileges windows-explorer

I'm debugging my application which has drag-n-drop features in Visual Studio 2010. I have to run the IDE in privileged mode since some of my project required so.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.