affiliate_link

Thursday, July 21, 2011

Zip Files or Folder On The Fly Using PHP

Zip Files
<?php
include_once 'CreateZipFile.inc.php';
$createZip = new CreateZipFile;
$createZip->addDirectory('/');
$filecontent1 = file_get_contents('fileone.txt');
$filecontent2 = file_get_contents('filetwo.txt');
$createZip->addFile($filecontent1, '/fileone.txt');
$createZip->addFile($filecontent2, '/filetwo.txt');
$zipFileName = 'myzip.zip';
$handle       = fopen($zipFileName, 'wb');
$out           = fwrite($handle, $createZip->getZippedFile());
fclose($handle);
$createZip->forceDownload($zipFileName);
@unlink($zipFileName);
?>
Zip Folder

<?php
include_once 'CreateZipFile.inc.php';
$createZip = new CreateZipFile;
$createZip->zipDirectory('/testdir', '');
$zipFileName = 'myzip.zip';
$handle       = fopen($zipFileName, 'wb');
$out           = fwrite($handle, $createZip->getZippedFile());
fclose($handle);
$createZip->forceDownload($zipFileName);
@unlink($zipFileName);
?>

Tuesday, July 5, 2011

Displaying iFrame content in a DIV

if your images are outside of your iFrame, of course your dropdown menu will not show up since you are trying to tell the dropdown menu to go out of its windows. iframe is a different window inside your html, therefore any overflow of the window will never go out, elements inside the iframe is not affected with the z-index.

what you could do is, if your http://website.com/dropdown.html has the dropdown content only, you can call it by jQuery

<div id="myDropDown">
</div>


<script type="text/javascript">
    $(document).ready(function() {
        $("#myDropDown").load("http://website.com/dropdown.html");
    });  
</script>

this will append the content of your dropdown.html into the div