courage Posted December 2, 2006 Report Share Posted December 2, 2006 Sveiki, es uztaisot lapu kur kods ir <? include ("C:\bans.txt"); ?> izveidojas tada lieta kad vis saskrien viena rinda un neko nevar saprast! Vai ir iespejams tas kad es sos visus tekstus izkopeju ara lapa ar visam atstarpem kas netika ieklautas lapa? Es nedrikstu likt html kodus faila, man tur vis savadak sajuks un bus loti gruti dzivot man talak :) (txt faila nedrikstu) Link to comment Share on other sites More sharing options...
Kristabs Posted December 2, 2006 Report Share Posted December 2, 2006 Nezinot neko vairāk var tikai minēt. Pasties funkcijas file_get_contents() , nl2br() , etc Apstrādā iegūto tekstu no bans.txt un izvadi tieši tā, kā vajag. Link to comment Share on other sites More sharing options...
courage Posted December 2, 2006 Author Report Share Posted December 2, 2006 Paldies :) <?php $string_text=file_get_contents("/path_to/file.txt"); // load text file in var $new_text=nl2br($string_text); // convert CR & LF in <br> in newvar echo $new_text; // print out HTML formatted text unset($string_text, $new_text); // clear all vars to unload memory ?> laba funkcija... noderes turpmaka dzive :) Link to comment Share on other sites More sharing options...
bubu Posted December 2, 2006 Report Share Posted December 2, 2006 unset ir bezjēdzīgs (šajā gadījumā) Link to comment Share on other sites More sharing options...
blackhalt Posted December 2, 2006 Report Share Posted December 2, 2006 Es gan ņemtu kādu: http://lv.php.net/manual/en/function.file.php ietu pāri un sazīmetu smuko noformējumu ;) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 3, 2006 Report Share Posted December 3, 2006 (edited) Izmanto parasto HTML tagu <pre> <pre> <?php include (tavs.txt); ?> </pre> edit: pareejie ieteikumi var sacakareet to txt faila formateejumu.. teiksm ja tur ir no simboliem veidots ziimeejums... Edited December 3, 2006 by Grey_Wolf Link to comment Share on other sites More sharing options...
bubu Posted December 3, 2006 Report Share Posted December 3, 2006 Grey_Wolf: paskaties uz faila nosaukumu. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 3, 2006 Report Share Posted December 3, 2006 bubu --> tieshi taa ja tas ir text fails tad mans ieteiktais variants ir optimaals jo kaada starpiiba? vai izmanto nl2br() vai izvadi taa kaa ir text faila... un piedevaam izmantojot nl2br() pazuud atstarpes ,respektiivi tiek apgrieztas liidz 1, (text formateejums).. [cit] izkopeju ara lapa ar visam atstarpem kas netika ieklautas lapa? [/cit] Link to comment Share on other sites More sharing options...
andrisp Posted December 3, 2006 Report Share Posted December 3, 2006 Ja skaidri zināms faila formatējums, tad man liekas nebūs visai labi izmantot <pre>. Link to comment Share on other sites More sharing options...
bubu Posted December 3, 2006 Report Share Posted December 3, 2006 Es vairāk to teicu par tiem ascii zīmējumiem. bans.txt ha! Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 3, 2006 Report Share Posted December 3, 2006 Ja skaidri zināms faila formatējums, tad man liekas nebūs visai labi izmantot <pre>. Kaapeec ? ja vajadziigs preciizi taads pats? manupraat tieshi tas kas vajadziigs... Link to comment Share on other sites More sharing options...
Recommended Posts