<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="all" />
<title>Standard installation - Open Power Libs</title>
<link rel="stylesheet" type="text/css" href="design/generic.css" media="all" />
<link rel="stylesheet" type="text/css" href="design/print.css" media="print" />
<!--[if lte IE 6]><link rel="stylesheet" href="design/ie.css" type="text/css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="design/ie7.css" type="text/css" /><![endif]-->
</head>
<body>
<div id="wrap">
<div id="header">
<h1>Open Power Libs 2.0</h1>
<h2>Standard installation</h2>
<p class="generated">@ 02.09.2010</p>
<p class="location"><a href="index.html"><strong>User manual</strong></a> » <a href="installation.html">Installation</a> » <a href="installation.standard.html">Standard installation</a></p>
</div>
<div id="content"><dl class="location"><dt><a href="installation.html">2. Installation</a><br/>2.1. Standard installation</dt><dd class="prev">2. Installation<br/><a href="installation.html">« Previous</a></dd><dd class="next">2.2. PHAR installation<br/><a href="installation.phar.html">Next »</a></dd></dl> <h1>2.1. Standard installation</h1><p>Create a single directory for the OPL libraries code called "installation directory". Each OPL package contains an <code>/lib</code> folder whose must be copied to the installation directory.</p>
<p>In order to use OPL libraries in your project, you need to load the core file and register an autoloader:</p>
<pre class="php"><span style="color: #b1b100;">require</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'../../lib/Opl/Base.php'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
Opl_Loader<span style="color: #339933;">::</span><span style="color: #004000;">setDirectory</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'../../lib/'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
Opl_Loader<span style="color: #339933;">::</span><span style="color: #004000;">register</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// use the libraries now</span></pre>
<p>OPL uses exceptions to report problems and errors. It is recommended to capture them. The basic exception class used by the libraries is <code>Opl_Exception</code>, but each of the libraries provides also its own class. OPL contains also the default exception handler:</p>
<pre class="php"><span style="color: #b1b100;">require</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'../../lib/Opl/Base.php'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
Opl_Loader<span style="color: #339933;">::</span><span style="color: #004000;">setDirectory</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'../../lib/'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
Opl_Loader<span style="color: #339933;">::</span><span style="color: #004000;">register</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
try
<span style="color: #009900;">{</span>
<span style="color: #666666; font-style: italic;">// your code</span>
<span style="color: #009900;">}</span>
catch<span style="color: #009900;">(</span>Opl_Exception <span style="color: #000088;">$exception</span><span style="color: #009900;">)</span>
<span style="color: #009900;">{</span>
Opl_Error_Handler<span style="color: #009900;">(</span><span style="color: #000088;">$exception</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span></pre>
<dl class="location location-bottom"><dt>2.1. Standard installation<br/><a href="installation.html">2. Installation</a></dt><dd class="prev"><a href="installation.html">« Previous</a><br/>2. Installation</dd><dd class="next"><a href="installation.phar.html">Next »</a><br/>2.2. PHAR installation</dd></dl> </div>
<div id="footer">
<p>Copyright © <a href="http://www.invenzzia.org/">Invenzzia Group 2008-2009</a></p>
<p>Available under the terms of license: <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License 1.2</a></p>
<p>Generated by <strong>TypeFriendly 0.1.4</strong> by <a href="http://www.invenzzia.org/">Invenzzia</a></p>
</div>
</div>
</body>
</html>