xEmoscreamOx Posted April 23, 2006 Report Share Posted April 23, 2006 Sveiciens! Man ir radusies problēma, ar kuru netieku viens pats galā. Script`ā ir paredzēts dotās vienības sašķirot alfabētiski un piešķirt tiem linku. Tas vēl tā - linkus tas izstrādā ar "_" atstarpju vietā, bet redzamo daļu tekstā vajadzētu kā atstarpi... Te arī sākas problēmas... aizvietot "_" redzamajā daļā ar atstarpi, bet lai linkos tas tā arī paliek... Te acīmredzot ir kļūda: <?php $narray[0]="Aska"; $narray[1]="Insomnia"; $narray[2]="Deepak"; $narray[3]="Beauty_of_Crying_Star"; $narray[4]="Joshua"; $narray[5]="Because_Eyes_Were_Closed"; $narray[6]="When_My_Authorities_Fall"; $narray[7]="In'Stora"; sort($narray); for($i=0; $i<8; $i++) //$narray[$i] = ereg_replace(' ', '_', $narray[$i]); { print '<a href="/?pg=bands&band=' . $narray[$i] . '">' . $narray[$i]; print '</a><br />'; } ?> Link to comment Share on other sites More sharing options...
Vebers Posted April 23, 2006 Report Share Posted April 23, 2006 for($i=0; $i<8; $i++) $neredzams=str_replace(' ', '_', $narray[$i]); $redzams=str_replace('_', ' ', $narray[$i]); { print '<a href="/?pg=bands&band=' . $neredzams . '">' . $redzams; print '</a><br />'; } Link to comment Share on other sites More sharing options...
xEmoscreamOx Posted April 23, 2006 Author Report Share Posted April 23, 2006 <?php $narray[0]="Aska"; $narray[1]="Insomnia"; $narray[2]="Deepak"; $narray[3]="Beauty_of_Crying_Star"; $narray[4]="Joshua"; $narray[5]="Because_Eyes_Were_Closed"; $narray[6]="When_My_Authorities_Fall"; $narray[7]="In'Stora"; sort($narray); for($i=0; $i<8; $i++) $neredzams=str_replace(' ', '_', $narray[$i]); $redzams=str_replace('_', ' ', $narray[$i]); { print '<a href="/?pg=bands&band=' . $neredzams . '">' . $redzams; print '</a><br />'; } ?> ? nedarbojas (bet kļūdu arī nav)... Link to comment Share on other sites More sharing options...
Vebers Posted April 23, 2006 Report Share Posted April 23, 2006 <?php $narray[0]="Aska"; $narray[1]="Insomnia"; $narray[2]="Deepak"; $narray[3]="Beauty_of_Crying_Star"; $narray[4]="Joshua"; $narray[5]="Because_Eyes_Were_Closed"; $narray[6]="When_My_Authorities_Fall"; $narray[7]="In'Stora"; sort($narray); for($i=0; $i<8; $i++){ $neredzams=str_replace(' ', '_', $narray[$i]); $redzams=str_replace('_', ' ', $narray[$i]); print '<a href="/?pg=bands&band=' . $neredzams . '">' . $redzams; print '</a><br />'; } ?> Link to comment Share on other sites More sharing options...
xEmoscreamOx Posted April 23, 2006 Author Report Share Posted April 23, 2006 Wow... Sirsnīgs PALDIES! :) Tas man palīdzēja... :) Link to comment Share on other sites More sharing options...
Klez Posted April 23, 2006 Report Share Posted April 23, 2006 (edited) itaa buutu mazaak rindinjas kodam :) <?php $narray[0]="Aska"; $narray[1]="Insomnia"; $narray[2]="Deepak"; $narray[3]="Beauty_of_Crying_Star"; $narray[4]="Joshua"; $narray[5]="Because_Eyes_Were_Closed"; $narray[6]="When_My_Authorities_Fall"; $narray[7]="In'Stora"; sort($narray); for($i=0; $i<8; $i++) //$narray[$i] = ereg_replace(' ', '_', $narray[$i]); { print '<a href="/?pg=bands&band=' . $narray[$i] . '">' . str_replace(' ', '_', $narray[$i]); print '</a><br />'; } ?> Edited April 23, 2006 by Klez Link to comment Share on other sites More sharing options...
xEmoscreamOx Posted April 23, 2006 Author Report Share Posted April 23, 2006 Mhm, uz aci gan nepamanīs... Es jau tā īsti vēl nerubiju php, bet gan jau ar laiku! :) Paldies! Link to comment Share on other sites More sharing options...
v3rb0 Posted April 23, 2006 Report Share Posted April 23, 2006 un $narray = array("Aska", "Insomnia", .. , "In'Stora"); Link to comment Share on other sites More sharing options...
Recommended Posts