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.

Empfohlene Antworten

Veröffentlicht

Also, ich soll eine Seite erstellen, bei der ein Diagramm dynamisch erzeugt wird, d.h., dass die Breitenangabe für ein Bild eine Variable ist, die aus einer .txt Datei gelesen wird, das Script sieht bisher folgendermaßen aus:

http://www.fh-trier.de/~kuegler/

<html>

<head>

<title>Druckerjobs</title>

</head>

<body>

<table border=0 cellpadding=1 cellspacing=0>

<tr>

<th>

cld2

</th>

<?

$fp = fopen("cld2.txt","r");

$a = $fp;

$a = intval($a);

print ('<td><img src=1.jpg height="12" width="§a" "noshade" color="red"></td>');

if ($fp)

{

$zeile = fgets($fp, 5);

print ('<td>');

print ($zeile);

print ('</td>');

fclose($fp);

}

else

echo "Datei wurde nicht gefunden";

?>

</tr>

</table>

</body>

</html>

Leider funktioniert das hier nicht, weiß jemand, wie ich die Variable deklarieren muss? Sollte durch 10 geteilt werden und gerundet, da sie sonst zu groß ist.

<html>

<head>

<title>Druckerjobs</title>

</head>

<body>

<table border=0 cellpadding=1 cellspacing=0>

<tr>

<th>

cld2

</th>

<?

$filename = "cld2.txt";

$fp = fopen($filename,"r");

$a = fread($fp,filesize($filename));

fclose($fp);

$a = intval($a);

print ('<td><img src=1.jpg height="12" width="$a" "noshade" color="red"></td>');

if ($fp)

{

$zeile = fgets($fp, 5);

print ('<td>');

print ($zeile);

print ('</td>');

fclose($fp);

}

else

echo "Datei wurde nicht gefunden";

?>

</tr>

</table>

</body>

</html>

oben fehlte ein dollar

print ('<td><img src=1.jpg height="12" width="§a" "noshade" color="red"></td>');

Sollte es nicht $a und nicht §a sein?

 $a = $fp;
$a = intval($a);
print ('<td><img src=1.jpg height="12" width="§a" "noshade" color="red"></td>');[/PHP]

Ich kann mir nicht vorstellen, das dies den gwünschten effekt hat.

1) $a bezeichnet einen Filepointer und nicht den inhalt der Datei. Dazu müsstest du den Inhalt zuerst mit fget, fread oder ähnlichen einlesen und kannst damit weiterarbeiten.

2) width="§a" wird auch nicht funktionieren. du solltest width="'.$a.'" verwenden

Bisher funktioniert davon leider nichts.... :(

Fehlermeldungen garkeine, es kommt nur einfach nicht dass, was kommen soll.

Wenn du auf den Link in meinem ersten Post klickst, siehst du, wie das Ganze aktuell aussieht.

Es schient so, dass einfach die Zahl in der .txt nicht richig erkannt wird und einfach 1 genommen wird.

poste ma deine src.

auch den inhalt der txt datei

http://www.fh-trier.de/~kuegler/

<html>

<head>

<title>Druckerjobs</title>

</head>

<body>

<table border=0 cellpadding=1 cellspacing=0>

<tr>

<th>

cld2

</th>

<?

$filename = "cld2.txt";

$fp = fopen($filename,"r");

$a = fread($fp,filesize(cld2.txt));

$a = $fp;

$a = intval($a);

$b = $a;

$a = $a / 10;

$a = round($a,2);

print ('<td><img src=1.jpg height="12" width='.$a.'"></td>');

if ($fp)

{

$zeile = fgets($fp, 5);

print ('<td>');

print ($B);

print ('</td>');

fclose($fp);

}

else

echo "Datei wurde nicht gefunden";

?>

</tr>

</table>

</body>

</html>

In der .txt Datei steht einfach nur:

4112

Das ist der aktuelle Wert, der da rein soll.


$filename = "cld2.txt";
$fp = fopen($filename,"r");
$a = fread($fp,filesize(cld2.txt));
// bis hier okay, aber die nächsten Zeilen ist mir unklar:
$a = $fp; // $a ist jetzt der Filepointer, damit ist der Wert weg. Lass die hier mal weg
$a = intval($a); // intval auf nen FilePointer?
$b = $a;
$a = $a / 10;
$a = round($a,2);
[/PHP]

Danke, ich habs jetzt:

<html>

<head>

<title>Druckerjobs</title>

</head>

<body>

<table border=0 cellpadding=1 cellspacing=0>

<tr>

<th>

cld2

</th>

<?

$filename = "cld2.txt";

$fp = fopen($filename,"r");

$a = fread($fp,filesize($filename));

$a = intval($a);

$b = $a;

$a = $a / 10;

$a = round($a,2);

print ('<td><img src=1.jpg height="12" width='.$a.'"></td>');

if ($fp)

{

$zeile = fgets($fp, 5);

print ('<td>');

print ($B);

print ('</td>');

fclose($fp);

}

else

echo "Datei wurde nicht gefunden";

?>

</tr>

</table>

</body>

</html>

Sollte jetzt klappen....

Vielen Dank für eure Hilfe :marine

Wenn ich mal wieder Hilfe brauche, melde ich mich....

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.