Blitz Posted February 17, 2006 Report Share Posted February 17, 2006 Tatad txt failaa informacija tiek rakstita saadaa veidaa... $file_handle=fopen("news.txt","x+"); fwrite($file_handle, "$date_now\n"); while (select row from db) { fwrite($file_handle, "|| $row[0] || $row[1] ||\n"; } fclose($file_handle); pec idejas, vaidzetu katram ierakstam ierakstities jaunaa linijaa, bet viss sagruuzas vienaa un "\n" vietaa izmet kaut kadu unknown simbolu... Kas varetu pa vainu but? Atkal kkadi kodejumi? man heders kaa utf-8, source fails kaa utf-8 saglabats... Link to comment Share on other sites More sharing options...
blackhalt Posted February 17, 2006 Report Share Posted February 17, 2006 winblows var to \n rakstīt arī šitā: ("\n") var šitā (" ") Link to comment Share on other sites More sharing options...
Blitz Posted February 17, 2006 Author Report Share Posted February 17, 2006 galigi neiebraucu ;/ paskaidro sikak... Link to comment Share on other sites More sharing options...
Delfins Posted February 17, 2006 Report Share Posted February 17, 2006 1.) Kāpēc ir jāsaglabā failā, ja ir DB? 2.) unicode failam vait ad nebija mistiskie 2 baiti priekšā? (lai pareizi rādītos citos editoros) 3.) Un vispār ko tu ar to failu dari? Vari nobeigt līniju ar \r\n Link to comment Share on other sites More sharing options...
Blitz Posted February 17, 2006 Author Report Share Posted February 17, 2006 1. jasaglabaa failaa jo fails tiek sutits uz ftp uz kura griezaas lapa un tur diemzel db nav, nakas izlidzeties ar txt 2. signature nebij prieksaa 3. failu izveidoju sarakstu visu info, aizsutu uz ftp kur tas php automatiski nolasa un izvieto jauno info webaa liniju tiesam nobeidzu \r\n - curve_hands :) Link to comment Share on other sites More sharing options...
Delfins Posted February 17, 2006 Report Share Posted February 17, 2006 Brr.... tavā gadījumā jau jāģenerē gatavi HTML kodi un katru ziņu glabāt atsevišķā failā... a stilu mainīt tas jau ir CSS PS: ziņu indeksu jau var glabāt kā PHP masīvu.. kur ir atsauce uz failu (tas var būt kaut vai tas pats XML..) Link to comment Share on other sites More sharing options...
Blitz Posted February 17, 2006 Author Report Share Posted February 17, 2006 gatavu html negribas generet, jo velos lai fails paliek viegli un erti modeficejams. taisot php masivu... hmm, tas ir tas pats kas generet gatavu html (laikam), jo viens php darbojas intranet tiiklaa zem ruutera un no weba nekadi pieklut newar. Nu istenibaa rakstisana failaa ar nav nekas traks, iespejams ka kadu 1\2 sekundi ilgak paprasis laiku, bet nu pofigs... vismaz ja kautkadas kludas gadaas sisteema tad atri vares ar roku izlabot... Link to comment Share on other sites More sharing options...
Delfins Posted February 17, 2006 Report Share Posted February 17, 2006 a ko tu gribi modificēt ? Ja vienu konkrētu "ierakstu" tad nu overkills... kļūdas neizbēgamas... Paņem kādu Text-DB un dzīvo laimīgs... (uploaded varēsi importa failu ar INSERT komandām) Link to comment Share on other sites More sharing options...
Blitz Posted February 17, 2006 Author Report Share Posted February 17, 2006 nu nez, tikko ietesteju viss stradaa uuberforsi... Link to comment Share on other sites More sharing options...
Delfins Posted February 17, 2006 Report Share Posted February 17, 2006 Uz cik lielu failu? ;) Link to comment Share on other sites More sharing options...
Blitz Posted February 17, 2006 Author Report Share Posted February 17, 2006 fails satur tikai svaigako informaciju t.i. jaunaka prece, precu grupas, bilzu nosaukumi, tatad ne vairak pa 100 rindinaam. Site tak mierigi var iztikt bez txt db... Viss ir loti vienkarsi, erti un visadi citadi labi. Vieniga problema ka php to failu neuztaisa utf-8 kodejumaa, taaka nakas izmantot windows-1257 Link to comment Share on other sites More sharing options...
v3rb0 Posted February 17, 2006 Report Share Posted February 17, 2006 vienīgā problēma ir ka gūglē nevaram ierakstīt 'php fwrite utf-8' un nospiest i'm feeling lucky.. $f=fopen("test.txt", "wb"); $text=utf8_encode("ā"); // adding header $text="\xEF\xBB\xBF".$text; fputs($f, $text); fclose($f); Link to comment Share on other sites More sharing options...
Recommended Posts