25 lip 2008

Lista plików w katalogu

 $sDir = "d:\\do_wysylki" if($sDir eq '');

opendir(SEND_DIR, $sDir)  or die "Couldn't open $dir for reading: $!";

@files = ();
while( defined ($file = readdir(SEND_DIR)) ) {

    next if ($file eq '.' or $file eq '..');

    my $filename = $file;
    push(@files, $filename);
}

closedir(SEND_DIR);

my $count  = @files; 

25 lip 2008

Parsowanie dokumentu XML - przykład

$res = file_get_contents($url);
$content_start  = strpos($res, '</form>') + strlen('</form>');

$head_end       = $content_start;
$content_end    = strpos($res, '</xml-export>');
$foot_start     = strpos($res, '</xml-export>');

$head    = substr($res, 0, $head_end);
$content = substr($res, $content_start, $content_end - $content_start);
$foot    = substr($res, $foot_start);

$content = nl2br(html_entity_decode($content));
$content = htmlspecialchars_decode($content);
$content = UTF8toISO2($content);
$html_doc = $content;
24 lip 2008

Wyświetlenie punktów z dymkami

var dane = new Array();
dane[0] = { lat: 52.224355732689, lng: 21.253480911255, dymek: '<span class="dymek"><b>opis</b></span>' }

var cnt = dane.length;
for (i = 0; i < cnt; i++) {
  var d = dane[i];
  var marker = new GMarker(new GPoint(d.lng, d.lat));
  map.addOverlay(marker);
  marker.openInfoWindowHtml(d.dymek);
}