senters Posted September 19, 2011 Report Share Posted September 19, 2011 Izmantoju .xml failu, kura viens no info laukiem (vērtībām) ir <url> ar vērtību - links uz .html saturu. Kā no šī linka iepostot db saturu plain tekstā. Ar attēlu būtu vienkārši, tā linku padodu <img> tega src parametrā, bet kā darīt ar html? Ceru, ka ir kaut nedaudz skaidrs kas par problēmu. Link to comment Share on other sites More sharing options...
daGrevis Posted September 19, 2011 Report Share Posted September 19, 2011 No linka datubāzes saturu plain-text'ā? Ko? :) Link to comment Share on other sites More sharing options...
senters Posted September 19, 2011 Author Report Share Posted September 19, 2011 (edited) Mēģināšu vēlreiz: <event> <eventid>19086</eventid> <title>...</title> ... <info>http://www.xxx.lv/yyy/123.html</info> </event> Kā no šī linka dabūt ārā saturu (plain textā) iekš db. Edited September 19, 2011 by senters Link to comment Share on other sites More sharing options...
briedis Posted September 19, 2011 Report Share Posted September 19, 2011 $dati = file_get_contents($links); Kā nopārsēt XML, vienkāršais variants: http://php.net/manual/en/book.simplexml.php Link to comment Share on other sites More sharing options...
senters Posted September 19, 2011 Author Report Share Posted September 19, 2011 Jā, pašu parsēšanu es arī ņemu ar simple xml. Paldies, skatīšos file_get_contents Link to comment Share on other sites More sharing options...
senters Posted September 19, 2011 Author Report Share Posted September 19, 2011 Tik tālu viss ok, vienīgi tas ko es dabūju no html ir formatēts teksts nu jā, jeb pats html. Kā dabūt vnk plaintekstu tālāk. Te piemērs kā ir patreiz - http://screencast.com/t/UjV3J6Ab Te izvades / pārveidošanas koda daļa: $d = mysql_query("select UNIX_TIMESTAMP(date_start) as date_echo, event.* from event where id = '".$e."'"); while($event = mysql_fetch_assoc($d)) { $description = file_get_contents($event['description']); echo $description; } Link to comment Share on other sites More sharing options...
briedis Posted September 19, 2011 Report Share Posted September 19, 2011 Plain tekstu, bez tagiem? izmanto strip_tags() Link to comment Share on other sites More sharing options...
senters Posted September 19, 2011 Author Report Share Posted September 19, 2011 Jā, man interesē vienkārši teksts. Mēģināšu ar strip_tags(). Link to comment Share on other sites More sharing options...
senters Posted September 19, 2011 Author Report Share Posted September 19, 2011 (edited) Paldies, šis darbojas, protams nākas dažus tag'us izmantot, paturēt, lai nav totāla biezputra. $d = mysql_query("select UNIX_TIMESTAMP(date_start) as date_echo, event.* from event where id = '".$e."'"); while($event = mysql_fetch_assoc($d)) { // no .html linka iegūst $description = file_get_contents($event['description']); // noņem tekstam tag'us (strip_tags($text, '<p><a>') - noņem visus tag'us izņemot $description = strip_tags($description, '<p><a>'); norādītos echo $description; } Edited September 19, 2011 by senters Link to comment Share on other sites More sharing options...
Recommended Posts