andre Posted October 21, 2003 Report Share Posted October 21, 2003 karoche, ir taads teksts : "asdasdas <!#MODULE:asd#>asdf asdf asdf <!#MODULE:fds#> asd asd as <!#MODULE:iuy#> sada" uztaisiit funkciju vai skriptu, kas beigaas izdariis luuk taaaa (tipa lai rezultaats buutu taads): "asdasdas ".$asd."asdf asdf asdf ".$fds." asd asd as ".$iuy." sada" Link to comment Share on other sites More sharing options...
Roze Posted October 21, 2003 Report Share Posted October 21, 2003 Nu vienkaarshakajaa un brutaakalajaa variantaa.. $string = "asdasdas <!#MODULE:asd#>asdf asdf asdf <!#MODULE:fds#> asd asd as <!#MODULE:iuy#> sada"; $string = str_replace('<!#MODULE:','".$',$string); $string = str_replace('#>','."',$string); Link to comment Share on other sites More sharing options...
BigUgga Posted October 21, 2003 Report Share Posted October 21, 2003 ja vaig ieguut tieshi "asdasdas ".$asd."asdf asdf asdf ".$fds." asd asd as ".$iuy." sada" izmanto Roze doto piemeeru, vai arii, ja gribas buut advanceetam ;) tad <? $patt = '/<!#MODULE:(.*)#>/iU'; $repl = '".$$1."'; $string = preg_replace($patt, $repl, $string); ?> ja vaig jau ar saliktiem visiem mainiigajiem, tad <? $patt = '/<!#MODULE:(.*)#>/iUe'; $repl = '$$1'; $string = preg_replace($patt, $repl, $string); ?> Link to comment Share on other sites More sharing options...
andre Posted October 22, 2003 Author Report Share Posted October 22, 2003 ideja ir taada, ka jaatorod stringaaa <#MODULE:asd#> jaanoslasa,kas ir peec MODULE: (<#MODULE:?#>) un pirms "#>" dotajaa variantaa ?=asd un tad jaaieliek mainiigais $$temp. kur $temp="asd" (tas kas sekoja peec "MODULE:") Link to comment Share on other sites More sharing options...
andre Posted October 22, 2003 Author Report Share Posted October 22, 2003 man liekas ka tas jaadara ar preg_match('/<#MODULE:?#>/i',"$string", $matches); tikai es to nosaciijumu nevaru uzrakstiit :( Link to comment Share on other sites More sharing options...
BigUgga Posted October 23, 2003 Report Share Posted October 23, 2003 taatad, ja ir dots 'tuci buci <#MODULE:asd#> cuci luci' un $asd = 'blabla' tad rezultaatam jaabuut 'tuci buci blabla cuci luci' ? jebshu rezultaatam jaabuut 'tuci buci <#MODULE:blabla#> cuci luci' Link to comment Share on other sites More sharing options...
andre Posted October 24, 2003 Author Report Share Posted October 24, 2003 JAAAA.... Link to comment Share on other sites More sharing options...
BigUgga Posted October 24, 2003 Report Share Posted October 24, 2003 kas JAAAAAAAAAAAAAAAAAAA ? Link to comment Share on other sites More sharing options...
andre Posted October 25, 2003 Author Report Share Posted October 25, 2003 tieshi to arii vajag, ko tu teici taatad, ja ir dots 'tuci buci <#MODULE:asd#> cuci luci' un $asd = 'blabla' tad rezultaatam jaabuut 'tuci buci blabla cuci luci' ? Link to comment Share on other sites More sharing options...
BigUgga Posted October 25, 2003 Report Share Posted October 25, 2003 es gan jautaaju 2as dazhaadas lietas, bet nu lai paliek. liekas, ka nemaz tik ljoti shitas risinaajums nav vajadziigs, jo manaa pirmajaa postaa jau tas ir. (skat koda 2o variantu) Link to comment Share on other sites More sharing options...
Recommended Posts