element Posted September 24, 2007 Report Share Posted September 24, 2007 (edited) varbuut kaadam ir idejas kur shajaa f-jaa ir probleema, jo vinjai drausmiigi nepatiik, kad masiivaa es ielaadeeju atpakalj jau sagatavotu tagu (varbuut ir idejas kaa to savaadaak vareetu paveikt?): function change_str2pic($str,$aid) { $array = explode(" ",$str); foreach ($array as $word) { if (ereg("^([)+(img[0-9])+(])$", $word)) { //echo "str atbilst [img22]"; $ima = substr($word, 4); //saakam ar naakosho charu aiz [img $ima = str_replace("]", "", $ima); //beigaas novaacam ] //$word="<img scr='images/article/".$article_id."_".$ima.".jpg'/>"; $word="<img scr='images/article/".$aid."_".$ima.".jpg'>"; } $newarray[] = $word; $str = implode(" ",$newarray); } //print_r($newarray); return $str; } Edited September 24, 2007 by element Link to comment Share on other sites More sharing options...
andrisp Posted September 24, 2007 Report Share Posted September 24, 2007 1) paste.php.lv vai arī code bbtags. 2) Ko nozīmē "drausmiigi nepatiik" ? Kļūdas paziņojumus ? Link to comment Share on other sites More sharing options...
element Posted September 24, 2007 Author Report Share Posted September 24, 2007 http://paste.php.lv/6127 ievadot aaa [img1] bbb jaaizvada aaa <img scr='1.jpg'> bbb bet uz doto briidi tiek izvadiits aaa bbb kad iznjem <img> tagu, tad nomainot uz kautko citu uz ko vajag nomainiit, tad tas straadaa, tb ja grib, lai nomainiitos nevis uz <img> bet piemeeram uz <br> Link to comment Share on other sites More sharing options...
andrisp Posted September 24, 2007 Report Share Posted September 24, 2007 Nez, man strādā. Tu sourcē vispār esi skatījies ? Link to comment Share on other sites More sharing options...
element Posted September 24, 2007 Author Report Share Posted September 24, 2007 (edited) nu ja, paarbaudu stringu pirms un peec funkcijas.. taatad probleema ir kur citur? wtf? nav skaidrs kaapeec tieshi tagus vinjsh masiivaa man atpakalj nesaliek.. jo: sanjemam stringu, kuru sadalam masiivaa pa vaardiem ar atstarpeem un skatamies vai kaads no stringiem satur liidz ar to img sanjem cipara veertiibu, kuru peectam izmanto img scr un tad elementaari saliek visu atpakalj vienaa mainiigajaa ar atstarpeem Edited September 24, 2007 by element Link to comment Share on other sites More sharing options...
andrisp Posted September 24, 2007 Report Share Posted September 24, 2007 Saku vēlreiz: Man strādā šis: ievadotaaa [img1] bbb jaaizvada aaa <img scr='1.jpg'> bbb bet uz doto briidi tiek izvadiits aaa bbb Link to comment Share on other sites More sharing options...
element Posted September 24, 2007 Author Report Share Posted September 24, 2007 (edited) es laikam kautko tomeer nesaprotu, jo mana funkcija izvada nepareizus datus, atstaajot masiiva pirmo elementu tukshu, kur vajadzeeja buut bildes tagam uz ff vispaar bilde neparaadaas, bet uz ie paraadaas taa it kaa bildes scr nebuutu pareizi noraadiits un taatad blaq [img1] blag Array ( [0] => blaq [1] => [2] => blag [3] => ) blaq blag shaadi man izskataas jaunais masiivs. kur vareetu buut probleema? :( nja, neuzmaniibas kljuuda - src pareizi ir. paldies par paliidziibu eniivei ;) Edited September 25, 2007 by element Link to comment Share on other sites More sharing options...
element Posted October 4, 2007 Author Report Share Posted October 4, 2007 (edited) kaa iespeejams sho uzrakstiit ar preg_replace, nesadalot masiivaa.. varbuut Jums ir kaadas idejas? patreizeejaa funkcija izdomaa dazhos gadiijumos tomeer izdot atpakalj to tagu [img1] (piemeeram), nepaarveidojot par <img> function change_str2pic($str,$aid,$nrpk,$type) { $array = explode(" ",$str); foreach ($array as $word) { if (ereg("^([)+(img[0-9])+(])$", $word)) { $ima = trim($word); $ima = substr($ima, 4); //saakam ar naakosho charu aiz [img $ima = str_replace("]", "", $ima); //beigaas novaacam ] if ($ima==$nrpk){ //jaasanaak ciparam, kuram jaabuut vienaadam $word='<br/><a href="images/article/'.$aid.'_'.$ima.'.'.$type.'" rel="thumbnail"><img src="images/article/'.$aid.'_'.$ima.'_s.'.$type.'" class="center"/></a><br/>'; } else $word=$ima; } $newarray[] = $word; $str = implode(" ",$newarray); } print_r($array); print_r($newarray); //aaa [img1] ccc [img2] ddd [img3] eee return $str; } Edited October 4, 2007 by element Link to comment Share on other sites More sharing options...
andrisp Posted October 4, 2007 Report Share Posted October 4, 2007 element, es tev iesaku pārāk nečakarēties un darīt šādi: http://www.google.lv/search?hl=lv&q=php+bbcode Link to comment Share on other sites More sharing options...
element Posted October 4, 2007 Author Report Share Posted October 4, 2007 (edited) grazie, apskatiishos bbcode :/ bez chakara jau nekaa nevar .. :) Edited October 4, 2007 by element Link to comment Share on other sites More sharing options...
Recommended Posts