Wuu Posted October 10, 2008 Report Share Posted October 10, 2008 $gallery = '../style/terrain/'; $dirContent = scandir($gallery); while (list($key, $val) = each($dirContent)) { echo $val; if (is_dir($val)) { add_tile($val.'/'.$val.'.png'); } } Kā pārbaudīt vai $val ir directorija ar vārdu? nevis "." vai ".."! Un vispār kaut kā nesanāk nekādīgi! Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 10, 2008 Report Share Posted October 10, 2008 (edited) Kā pārbaudīt vai $val ir directorija ar vārdu? nevis "." vai ".."! Direktorija ar Vardu -->brendu/ zimolu ;) --- shajaa gadijumaa tas punkts vai vairaki arii ir direktorijas apzimejums (preciizak dziljuma/limenja apzimejums ) taa arii parbaudi vai nav ( . ) , vai ( .. ) edit : principa taa ir tieshi taada pati parbaude kaa butu A AA AAA Edited October 10, 2008 by Grey_Wolf Link to comment Share on other sites More sharing options...
Wuu Posted October 10, 2008 Author Report Share Posted October 10, 2008 (edited) $gallery = '../style/terrain/'; $dirContent = scandir($gallery); while (list($key, $val) = each($dirContent)) { echo $val; } . .. grass none.gif is_dir('grass'); is_dir($val); neatgriež ka tā ir direktorija ko darīt? is_dir atgriež true tikai uz punktiem "." ".." :) Edited October 10, 2008 by Wuu Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 10, 2008 Report Share Posted October 10, 2008 a kapeec negribi izmantot readdir() ?? <?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file\n"; } } closedir($handle); } ?> P.S. piemers pa taisno no manualja ... Link to comment Share on other sites More sharing options...
Wuu Posted October 10, 2008 Author Report Share Posted October 10, 2008 $gallery = '../style/terrain/'; $dirContent = scandir($gallery); while (list($key, $val) = each($dirContent)) { if ((is_dir($gallery.$val)) && ($val != ".") && ($val != "..")) { echo $val.' true'; } } Biju domājis ,bet šis tak strādās ātrāk ne ? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 10, 2008 Report Share Posted October 10, 2008 nu apskaties tachu manuali gan vienu gan otru f-ju ... tur tachu lietotaju piemeru un komentaru pietiekami daudz ... Tev pasham neliekas ka taas buus daudz aatrak, nekaa gaidiit kamer te kaads atbildes... P.S. tas aatraak / leenak ir tik nieciigs ka par to nav verts satraukties .... Link to comment Share on other sites More sharing options...
Wuu Posted October 10, 2008 Author Report Share Posted October 10, 2008 Piedod es vairs tā nedarīšu.. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 10, 2008 Report Share Posted October 10, 2008 (edited) Piedod es vairs tā nedarīšu.. Man ta kas ... Pats jau Sev dari pari .. PHP manualis ir tiesam labs un diezgan sakariigi izveidots, teiksim MySql orginalais manualis nebuut nav tik parskatams ... kad tur kautko aatri vajag atrast , tad ir daudz gruutak (teiksim iebuuvetas pamatfunkcijas, pamegjini ievadiit daljeju nosaukumu [teiksim ja zini ka ir, bet neatceries preciizu rakstiibu ] , lielakoties tevi pasuutiis uz google ... ) ... Nu tas jau Oftopic.... Edited October 10, 2008 by Grey_Wolf Link to comment Share on other sites More sharing options...
Wuu Posted October 10, 2008 Author Report Share Posted October 10, 2008 (edited) Nu jau tā ka es googli nelietoju un manuāli neskatos. Vienkārši ir tāda lieta ka "pieredzes trūkums" :D php manuālis ir labākais manuālis kāds redzēts ,mysql vispār klāt nestāv! Vienīgais trūkums viņam pārāk daudz funkciju ,visas atcerēties nevar :) Edited October 10, 2008 by Wuu Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 11, 2008 Report Share Posted October 11, 2008 (edited) Vienīgais trūkums viņam pārāk daudz funkciju ,visas atcerēties nevar :) nu bet tev jau jatceraas 1 funkcijas, kas atbilst temai , kaut daljejs nosaukums ... talak mekle, atrod pareizo nosaukumu --> un skaties liidziigas & papildus nepieciesamaas ... Visam funkcijam kas paredzeets kaadam liidzigam merkjim ir Pilns saraksts , teiksim stringu vai masiivu apstrade ... ieraksti strings vai array un dabuun pilnu sarakstu ar paskaidrojumu ko katra f-ja dara ... nu talak jau nav seviskja problema atrast vajadziigo ... tev tikai vajadzeja ierakstiit filesystem .... Edited October 11, 2008 by Grey_Wolf Link to comment Share on other sites More sharing options...
Recommended Posts