Diskussionsgruppe: PHP
Hallo, wenn ich zum Beispiel mit
code: $content = file_get_contents($file); echo $content;
eine PHP datei auslese... dann klappt das wunderbar, allerdings wird der anfang nicht angezeig, d.H. wenn ich eine .php datei auslese in der folgendes drinnsteht:
<?php include "sys/common.php"; $tpl->assign("welcome", $lang['welcome']); $tpl->printToScreen(); // templatefile ausgeben include('design/footer.php'); //footer einbinden ?>
wird nur das ausgegeben:
assign("welcome", $lang['welcome']); $tpl->printToScreen(); // templatefile ausgeben include('design/footer.php'); //footer einbinden ?>
WARUM DAS?
Wäre über Hilfe und Aufklärung erfreut!
grüße Valentin ;-)
PS: Also ich will den Inhalt der Datei auslese, bzw in einem textarea ausgeben.
Von: Valentin Datum: 08.02.2007, 10:53
Antwort 1
von greg68 vom 08.02.2007, 11:00
Hallo,
versuchs doch mal nach dem Muster:
<? $fn="datei.txt";
$fp=fopen($fn, "r"); $inhalt=fread($fp, filesize($fn)); fclose($fp);
echo "<input type='textarea' value='$inhalt'> </textarea>"; ?>
Gruss
Antwort 2
von TombDevil vom 08.02.2007, 11:04
Hi Valentin,
weil echo() HTML ausgibt und deshalb den Teil von <?php bis zum ersten $tpl-> als HTML-Tag interpretiert. Du wirst sehen, dass es im Browserquelltext steht, nur nicht angezeigt wird.
Lösung: Wandle vor der Ausgabe HTML-Tags um mit htmlentities(), also
echo('<PRE>'.htmlentities($content).'</PRE>');
Ciao TombDevil
Antwort 3
von Valentin vom 08.02.2007, 11:16
Hallo,
ich habe jetzt
$content = file_get_contents($file); echo('<PRE>'.htmlentities($content).'</PRE>');
drinnen, aber es ist das selbe problem, im quelltext von firefox steht nun:
<textarea id="elm1" name="elm1" rows="15" cols="80"> <PRE><?php
include ('sys/common.php'); $tpl->assign("welcome", $lang['welcome']); $tpl->printToScreen(); // templatefile ausgeben include('design/footer.php'); //footer einbinden ?></PRE></textarea>
ausgegeben wird:
<pre> assign("welcome", $lang['welcome']); $tpl->printToScreen(); // templatefile ausgeben include('design/footer.php'); //footer einbinden ?> </pre>
Danke schon mal für eure Hilfe.
Valentin
Antwort 4
von Valentin vom 08.02.2007, 11:18
Nachtrag (sry wegen doppelpost):
wenn ichs ohne textarea mache geht es nun !
Antwort 5
von Valentin vom 08.02.2007, 11:21
(*Z* dreifachpost O.o)
also es geht bei nem normalen texarea doch, allerdings habe ich den tiny_mce. editor und da gehts nich... hmm...
Antwort 6
von Valentin vom 12.02.2007, 08:56
Hallo, ich wollte noch mal fragen ob irgendwer noch eine Lösung kennt... sonst muss ich alles umbauen. :-/
danke! valentin
Antwort 7
von Bernd124 vom 28.02.2007, 20:30
Hallo, habe ein ähnliches Problem, hat jemand eine Lösung gefunden?
Beste grüße bernd
|
07111
07112
07113
07114
07115
07116
07117
07118
|