אני לא חושב שיש פה הרבה שמשתמשים בPHP5, אבל לאלו שכן:
יש לי פה שגיאה מוזרה, ניסיתי מספר פיתרונות לבעיה אבל אני לא מצליח לסדר את זה.
הצבתי בConstructor בדיקה של אם זה טמפלייט של פורום, ואם כן שיתן שגיאה, בדיקה פשוטה, ועדיין מתקבלת על כך שגיאה.
PHP קוד:
<?Php
##@
##@
##@
class TemplatesError extends Exception
{
function __construct()
{
}
}
class LoadingError extends TemplatesError
{
function __construct()
{
Exception::__construct("Loading Error: Template Does Not Exists.",2);
}
}
class GetTemplate
{
private $path = '../templates';
function __construct($toLoad)
{
global $DB;
if($toLoad == 'forum')
{
throw new LoadingError();
}
}
}
try
{
}
catch(TemplatesError $err)
{
echo $err->getMessage();
}
$template = new GetTemplate($toLoad);
?>
אני מקבל את השגיאה הבאה:
ציטוט:
Fatal error: Uncaught exception 'LoadingError' with message 'Loading Error: Template Does Not Exists.' in /home/webproject/Desktop/sites/PageMaker/templates/GetTemp.php:30 Stack trace: #0 /home/webproject/Desktop/sites/PageMaker/templates/GetTemp.php(46): GetTemplate->__construct('forum') #1 /home/webproject/Desktop/sites/PageMaker/forum/index.php(14): include('/home/webprojec...') #2 {main} thrown in /home/webproject/Desktop/sites/PageMaker/templates/GetTemp.php on line 30
|
ניסיתי מספר דרכים לפתור את השגיאה אבל לא הצלחתי :S
-טל