Location: PHPKode > scripts > packagex > packagex/documentation/Package.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class Package</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			
<h2 class="class-name">Class Package</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
                <p class="implements">
            Implements interfaces:
            <ul>
                <li><a href="../packagex/Packagable.html">Packagable</a></li>            </ul>
        </p>
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Class Package</p>
<p class="description"><p>Class provides methods to import packages of classes without the need to use  __autoload(). This is achieved via its public method import($path) which allows  a Java-Like type of import.</p><p>It allows to use the wild card character * to import all php  classes in a directory.</p><p>Example of usage in home directory:</p><p><pre>include_once("classes/Package.class.php");
 $package = new Package();
 $package->import('classes.*');
 $package->import('classes.sql.*');
 Or can be used to import single classes
 $package->import('classes.sql.AClass.php')</pre></p></p>
	<ul class="tags">
				<li><span class="field">version:</span> 1.0</li>
				<li><span class="field">author:</span> Carlo Tasca</li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_Package_class_php.html">/Package.class.php</a> (line <span class="field">24</span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>




	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
												<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
								
				<div class="method-definition">
											<span class="method-result">Package</span>
										<a href="#__construct" title="details" class="method-name">__construct</a>
										()
									</div>
								
				<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#import" title="details" class="method-name">import</a>
											(<span class="var-type">String</span>&nbsp;<span class="var-name">$import</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#loadClasses" title="details" class="method-name">loadClasses</a>
											([<span class="var-type">string</span>&nbsp;<span class="var-name">$path</span> = <span class="var-default">""</span>])
									</div>
							</div>
		</div>
	</div>		

	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="method__construct" id="__construct"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">Constructor __construct</span> (line <span class="line-number">43</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constuctor for Package objects</p>
<p class="description"><p>Initialises private members imports and classesIds</p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Package</span>
		<span class="method-name">
			__construct
		</span>
				()
			</div>
	
		
		
	</div>
<a name="methodimport" id="import"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">import</span> (line <span class="line-number">60</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">import(String) method</p>
<p class="description"><p>Feeds the imports array for this class.</p><p>Array of imports is to be processed in loadClasses($path) method</p><p>$import must be of type dir.subdir.className (without extension .class.php)</p><p>wild card * can be used to import all classes in a directory, provided they were</p><p>always named using the extention &quot;.class.php&quot;</p><p>If you have a different class naming convention set up for your classes you simply need to edit this method and the loadClasses($path) method</p><p></p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			import
		</span>
					(<span class="var-type">String</span>&nbsp;<span class="var-name">$import</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$import</span>			</li>
				</ul>
		
		
	</div>
<a name="methodloadClasses" id="loadClasses"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">loadClasses</span> (line <span class="line-number">102</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">loadClasses($path)</p>
<p class="description"><p>To be called after all calls to import() have been made</p><p>$path should be in the form (../ or ../../ etc) and represents the location where all classes for your projects are located</p><p>For example if you have files calling this method in public_html,  and classes to load in public_html/classes there is no need to change the default value  for $path argument.</p><p>If you are loading classes from a directory above the location of the file calling this  method $path should be set to ../ or ../../ and so on.</p><p>The best way to define $path is to do it via a constant variable in the Packagable interface file, before the definition of the interface itself is made.  This to avoid having the / characters as a argument to this function.</p><p></p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			loadClasses
		</span>
					([<span class="var-type">string</span>&nbsp;<span class="var-name">$path</span> = <span class="var-default">""</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$path</span>			</li>
				</ul>
		
		
	</div>
						
		</div>
	</div>


	<p class="notes" id="credit">
		Documentation generated on Sat, 23 Feb 2008 21:29:14 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</div></body>
</html>
Return current item: packagex