Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP und XHTML

Empfohlene Antworten

Veröffentlicht

Hallo, ich hab folgendes "Problem":

Eine XHTML Datei fängt ja mit der Angabe <?xml version="1.0"?> an. Nur damit ist es ja eine korrekte XHTML Datei.

Wenn ich jetzt aber eine Datei habe, die PHP Code enthält interpretiert der interpreter die Angabe ans PHP Code und gibt mir nen Fehler zurück. Also meine Datei sieht folgendermassen aus:


<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">
<html>
<head>
<title>Ausgabe</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<p>
<?php
include ...
...
...
...
?>
</p>
<p>
<div style="font-height: 8px; font-color: #AA0000; text-align: center;"><a href="index.html">Index</a></div>
</p>
</body>
</html>
[/php]

Da es nur für einen Test ist werd ich die Versionsangabe jetzt mal wegmachen. Aber wie löse ich das sonst? Hat schonmal jemand so ein Problem gehabt?

Ok, ich kann in der PHP-Config einstellen, dass er nur auf [b]<?php[/b] reagiert. Aber was wäre, wenn ich keinen Einfluss auf die Config hätte? Bei einem Webhoster z.B.

Meiner Meinung nach, müsste das so laufen:


<?php
echo("\<\?xml version=\"1.0\"\?\>");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">
<html>
<head>
<title>Ausgabe</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<p>
<?php
include ...
...
...
...
?>
</p>
<p>
<div style="font-height: 8px; font-color: #AA0000; text-align: center;"><a href="index.html">Index</a></div>
</p>
</body>
</html>[/PHP]

Probiers mal so aus. Wenn es dann nicht klappt, kannst du vor dem < und dem > auch die \ weglassen. Wenn es dann nicht läuft, weiß ich auch nicht weiter.

Meiner Meinung nach, müsste das so laufen:

Es tut ohne die \

<?php

echo("<?xml version=\"1.0\"?>");

?>

Danke.

Hi!

IMHO müste ein


<?php ini_set('short_open_tag', '0'); ?>

<?xml version="1.0" ?>

auch gehen.

Gruß, Tobias

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.