diff options
author | admin <devnull@localhost> | 2006-10-01 21:20:24 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-10-01 21:20:24 +0200 |
commit | 70d553b847ad86b8f1cf2a93f322a3c918b03ba0 (patch) | |
tree | 58da38843b2ec97513d26bc57c43ba24665aff27 /user_guide | |
parent | 24dd7e71d2587c4290c85bc85e0e181b29ab0539 (diff) |
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/libraries/zip.html | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/user_guide/libraries/zip.html b/user_guide/libraries/zip.html index 4fecde6a1..3c3e44b83 100644 --- a/user_guide/libraries/zip.html +++ b/user_guide/libraries/zip.html @@ -62,10 +62,50 @@ Zip Encoding Class <h1>Zip Encoding Class</h1>
+<p>Code Igniter's Zip Encoding Class classes permit you to create Zip archives.</p>
+
+
+<h2>Initializing the Class</h2>
+<p>Like most other classes in Code Igniter, the Zip class is initialized in your controller using the <dfn>$this->load->library</dfn> function:</p>
+
+<code>$this->load->library('zip');</code>
+<p>Once loaded, the Parser library object will be available using: <dfn>$this->zip</dfn></p>
+
+<h2>Usage Example</h2>
+
+<p>Simple example demonstrating how to compress a file and download it to your desktop.</p>
+
+<code>
+$name = 'mydata1.txt';<br />
+$data = 'A Data String!';<br />
+$this->zip->add_data($name, $data);<br />
+<br />
+$name = 'mydata2.txt';<br />
+$data = 'Another Data String!';<br />
+$this->zip->add_data($name, $data);<br />
+<br />
+
+$this->zip->download('my_backup.zip'); // Parameter contains name of the downloaded file
+</code>
+
+<p>If you would like to place your data into a folder just include the directory as part of the filename:</p>
+
+
+<code>
+$name = 'myfolder/mydata1.txt';<br />
+$data = 'A Data String!';<br />
+$this->zip->add_data($name, $data);<br />
+<br />
+$name = 'myfolder/mydata2.txt';<br />
+$data = 'Another Data String!';<br />
+$this->zip->add_data($name, $data);<br />
+<br />
+
+$this->zip->download('my_backup.zip'); // Parameter contains name of the downloaded file
+</code>
+
-<p>Code Igniter's Zip Encoding Class classes permit you to create requests to another server, or set up
-your own XML-RPC server to receive requests.</p>
|