nemec Posted July 2, 2007 Report Share Posted July 2, 2007 Kaa var sadaliit html tekstu uz vairaakiem vienaadiem (peec teksta garuma) gabaliem? Link to comment Share on other sites More sharing options...
ohmygod Posted July 2, 2007 Report Share Posted July 2, 2007 strlen? --> substr? Link to comment Share on other sites More sharing options...
nemec Posted July 2, 2007 Author Report Share Posted July 2, 2007 (edited) un kaa tu to iedomaajies, ja man teksts ir : hali gali trali vali, te mana bilde <img src="" alt="" /> hali gali trali vali, te mana bilde <img src="" alt="" />hali gali trali vali, te mana bilde <img src="" alt="" /> hali gali trali vali, te mana bilde <img src="" alt="" /> man likaas, ka ir vienkaarsh variants 1) iznjem tagus un izmeera garumu 2) sagriezh 3) aiztaisa vai attaisa tagus, vai saliek bildes atpakalj tas ir viss. kur taadu var atrast? Edited July 2, 2007 by nemec Link to comment Share on other sites More sharing options...
NiTrino Posted July 2, 2007 Report Share Posted July 2, 2007 (edited) ieraksti kaut kaadu <-separator-> un taisi $arr=explode('<-separator->',$str); tad ari tev lapa 1 buus $arr[0], lapa 2 buus $arr[1] utt Edited July 2, 2007 by NiTrino Link to comment Share on other sites More sharing options...
nemec Posted July 2, 2007 Author Report Share Posted July 2, 2007 tas ir diezgan neerts variants: 1) to nevar mainiit (shodien es gribu daliit pa 50 simboliem, bet riit pa 150) 2) man jaasaglabaa tas separator (tas nebuut nav prieksh vaajiem nerviem, ja tekstu ir daudz) Link to comment Share on other sites More sharing options...
xPtv45z Posted July 2, 2007 Report Share Posted July 2, 2007 Īsti nesapratu, ka un kā jādala, bet kaut kas tāds neder? function splitText($matches){ $len = 30; $splitChar = "\n"; return wordwrap($matches[1], $len, $splitChar, true); } $string = preg_replace_callback('/>(\w+)</', 'splitText', $string); Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 2, 2007 Report Share Posted July 2, 2007 (edited) gruuti iztikt bez seperaatora :( vajag atcereeties kur bija Tagi... rezultaataa sanaaks vairak limenju masiivs Xarray[0] x1[0]='tags pirms fragmenta ja taads ir' x2[1]="TEXTC" Aptuvenais Algoritms: 1 samekleejam 1 tagu rakstam masiivaa: cekojam texttu... + parbaudam vai nesakas jauns taags: sakas .... nemam nakamo masiiva elementu.... + pieseivojam Tagu... Nesakas un sasniegts attiecigais (max garums) nemam nakamo masiiva el .... utt.... ---------- Godiigi sakot nevaru iedomaaties kur kautko taadu varetu pielietot.... --------- 2 variants... iznemam visus tagus un to vietaa ierakstam seperaatoru (kaadu specefisku simbolu virkni) sakraameejam tagus masiivaa sagriezjam textu ..... pie skjiteesans atpakal --> sastikjemam atpakalj textu ar visiem seperaatoriem (seperaatoru droshi var griest daljaas) seperatorus seciigi aizvietojam ar taagiem P.S. un prichom tur nervi? Neba jau to dariisi ar rokaam ;) Edited July 2, 2007 by Grey_Wolf Link to comment Share on other sites More sharing options...
bubu Posted July 2, 2007 Report Share Posted July 2, 2007 Tas saucās koks, nevis vairāklīmeņu masīvs :) Un koku var implementēt ne tikai ar vairāklīmeņu masīvu. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 2, 2007 Report Share Posted July 2, 2007 Tas saucās koks, nevis vairāklīmeņu masīvs :) Nee Es nebiju domaajis Koku ;) preciizak 2 limenju masiivu kur, katrs masiiva elements sastaav no 1 array ar 2 shuunaam ... FOR(x) [x][0] = HTML [x][1] = text fragmentss NEXT FOR Link to comment Share on other sites More sharing options...
tmpjail Posted July 2, 2007 Report Share Posted July 2, 2007 daudzdimensionāls masīvs varbūt domāji ? :) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 2, 2007 Report Share Posted July 2, 2007 tmpjail --> Un kada starpiiba kaa to nosauc? Link to comment Share on other sites More sharing options...
Recommended Posts