Hallo Dimi,
Ich habe es jetzt einige Tage laufen lassen und es
funktioniert wunderbar…
Kann mann eigentlich den Text in den Array’s auch formatieren?
Die Html-Befehle wie
oder nimmt er an aber nicht
das Hat PHP eigene Vormatierungsbefehle?
Die Formatierung macht man mit css, je nach Verwendungs-
zweck kann man auch mal ‚inline-css‘-Formatierung verwenden.
Ein Beispiel (Datei zitate.php):
<?php # HTML vorbereiten<br /> $zitathtml =
'
$ZITAT\_HIERHIN
';
# heutiges Zitat laden
$db\_id = get\_nietzsche\_quote\_list();
$auth = 'Friedrich Nietzsche';
$uri = 'www.zitate-aphorismen.de/zitate/ext?ext\_id=';
$dbn = date('z') % sizeof($db\_id); # rand(0, sizeof($db\_id)-1);
$content = file\_get\_contents('http://' . $uri . $db\_id[$dbn]);
# reinen Text finden
if(preg\_match('| (.+?) |', $content, $matches))
$text = "{$matches[1]}
($auth)";
else
$text= " not found: ({$db\_id[$dbn]}) ";
# in HTML eintragen und ausgeben
echo preg\_replace('|\$ZITAT\_HIERHIN|', $text, $zitathtml);
# Datenbank-ID's fuer Nietsche-Quotes
function get\_nietzsche\_quote\_list()
{
return Array(1257,1864,2825,2829,1863,2590,1855,2830,2676,1260,1850,2580,3179,
1258,2591,2593,2656,3036,2834,2839,352,1873,1274,2840,1872,2675,1022,1867,1843,
1261,2702,3067,358,359,2653,1871,2700,3044,3162,2807,1840,3058,3061,1273,2582,
2841,3052,1849,1851,2691,294,350,2654,1263,1472,2838,2686,2693,351,2697,1862,
2680,334,2802,2657,2701,362,2681,2045,1844,2805,2584,2547,1857,2688,2588,3035,
1342,2704,356,3068,2583,3185,1268,2824,1865,1259,3050,2589,2678,2690,1878,365,
353,2597,1133,3159,1254,1256,364,1249,360,3193,1854,1858,3163,2581,2009,1924,
2585,164,1875,2044,3105,2696,2806,1270,361,2677,2837,1847,2842,1271,2647,1859,
2594,1250,2698,3083,1841,1266,1848,355,354,1252,2699,1853,1347,2655,143,1251,
2685,1255,2586,1264,1262,3072,2843,1846,3051,3141,2703,3057,1869,2831,1265,
1874,1870,3034,1852,1861,2598,2682,363,1860,3191,1842,1272,2579,2695,357,1350,
349,2804,2596,2803,1868,1253,2694,3090,259,268,333,253,1021,252,254,286,243,325,
221,303,1079,321,293,284,263,248,242,218,292,271,299,301,262,310,320,237,345,304,
235,288,273,225,328,1460,266,239,234,300,1078,244,346,228,327,290,289,287,230,348,
1080,267,216,324,224,265,261,291,312,222,297,227,330,233,2684,258,236,274,246,276,
257,283,335,1856,255,322,307,231,245,217,247,232,238,302,306,264,323,220,2687,256,
329,275,326,295,2595,240,251,285,250,298,229,272,219,347,311,241,249,305,332,223);
}
?\>
d.h., Du trägst im oberen Teil einafch
die gewünschten Css-befehle ein.
grüße
CMБ