I'm at the moment at a dead end and don't have any idea where the mistake is!...
The strange thing is that my script works fine on one my test-server but dosn't work on the main server. Maybe some configuration possibility in php.ini or apache? Don't know if that is the correct direction to search for.
Here an explanation what my script actually does:
The concept makes possible the sepearation of php-code (logic) and html-code(design). My html templates hold variables e.g. <?=$strMeldung?>
These variables must be filled with content and be inserted in the html-template. The "filling" of the variables with content is done by php-modules, in this case "mod_auswahl.php".
1. Start with the modul "mod_auswahl.php".
2. In the modul "mod_auswahl.php" the function strReadTemplate() reads in the html-template "loeschen.template.html" and returns die read in html-page as a string.
3. The fuction eval() evaluates the string, as if it was php-code, that is executes the string as php. Since eval() begins in „php-modus“ the string that is to be evaluated begins with ?> (php ends),
$strTemplate holding a html-template. „?>“ provides the function eval() with the expected php-code at the beginning. Herewith changing from PHP-modus to HTML-modus.
=>Recapitulatory the place holders (=variables) in the html-templates will be filled up with values. At the end the place holder $strMeldung holds the value "foobar".
Thanks for your help!
mod_auswahl.php:
----------------
Code: Select all
<?php
include "mod_templates.php";
$strMeldung = "foobar";
$strTemplate = strReadTemplate("loeschen");
$strOutput = eval ( "?>".$strTemplate."<?");
echo $strOutput;
?>mod_templates.php:
------------------
Code: Select all
<?php
function strReadTemplate ($strTemplateName, $filetype="htm") {
$strTemplateFile = "../templates/".$strTemplateName.".template.".$filetype;
$strTemplateContent = implode("", file($strTemplateFile));
return $strTemplateContent;
}
?>----------------------
Code: Select all
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../common/style.css" type="text/css">
<style type="text/css">
</style></head>
<body>
Hier steht folgendes: <?=$strMeldung?>
</body>
</html>OUTPUT
*******
WRONG outputed source code on server1, the place holder (variable) is as is!
------------------------------------------------
Code: Select all
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../common/style.css" type="text/css">
<style type="text/css">
</style></head>
<body>
Hier steht folgendes: <?=$strMeldung?>
</body>
</html>Works fine, the variable $strMeldung is evaluated and outputs "foobar"
-----------------------------------------------------------------------------
Code: Select all
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../common/style.css" type="text/css">
<style type="text/css">
</style></head>
<body>
Hier steht folgendes: foobar
</body>
</html>