| 
<?php
 /*
 * Copyright (C) 2014 Everton
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 
 /**
 * This file is a simple example use for Ptk\utils\ScriptLoader Class
 */
 
 try{
 require 'examples.inc.php';
 $loader = new \Ptk\utils\ScriptLoader(\Ptk\utils\ScriptLoader::getDirTree('..'));//get a instance of loader
 
 //show the include path
 echo '<pre>';
 print_r($loader->getPath());
 echo '</pre>';
 
 try{
 $loader->load('ptk.utils.validator.class.php');//require_once equivalent
 } catch (Exception $ex) {
 throw $ex;
 }
 if(class_exists('Ptk\utils\Validator', false)){
 echo '<p>ptk.utils.validator.class.php loaded!</p>';
 }else{
 echo '<p>Fail on load ptk.utils.validator.class.php!</p>';
 }
 
 try{
 $loader->load('ptk.utils.debug.class.php', false);//include_once equivalent
 } catch (Exception $ex) {
 throw $ex;
 }
 if(class_exists('Ptk\utils\Debug', false)){
 echo '<p>ptk.utils.debug.class.php loaded!</p>';
 }else{
 echo '<p>Fail on load ptk.utils.debug.class.php!</p>';
 }
 
 } catch (Exception $ex) {
 echo $ex->getMessage();
 //echo $ex->getTraceAsString();
 exit($ex->getCode());
 }
 
 
 |