Error in my component for Hello World
Posted: Tue Mar 18, 2008 9:44 am
I have just installed my jommla 1.5 in my computer. I have been trying out the hello world codes that I have found in the documentation in the manuals.
I have no problems with the code when I am using only one file. But when I introduce the hello.html.php file, I get the following error message:
'Fatal error: require_once() [function.require]: Failed opening required '' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\joomla15\components\com_helloworld\helloworld.php on line 5'
The codes are as follows:
helloworld.php
<?php
defined('_JEXEC') or die('Restricted access');
// require the html view class
require_once (JApplicationHelper :: getPath('front_html', 'com_hello'));
$task = JRequest::getVar('task');
$name = JRequest::getVar('name', 'John');
switch ($task) {
case 'show':
default:
hello_HTML::show($name);
break;
}
?>
helloworld.html.php
<?php
// no direct access
defined('_JEXEC') or die('Access to this file is probibited');
class hello_HTML {
function show($name) {
echo 'Welcome ' . $name . ' to our World!';
}
}
?>
can someone tell me what is wrong and how do i correct it?
I have no problems with the code when I am using only one file. But when I introduce the hello.html.php file, I get the following error message:
'Fatal error: require_once() [function.require]: Failed opening required '' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\joomla15\components\com_helloworld\helloworld.php on line 5'
The codes are as follows:
helloworld.php
<?php
defined('_JEXEC') or die('Restricted access');
// require the html view class
require_once (JApplicationHelper :: getPath('front_html', 'com_hello'));
$task = JRequest::getVar('task');
$name = JRequest::getVar('name', 'John');
switch ($task) {
case 'show':
default:
hello_HTML::show($name);
break;
}
?>
helloworld.html.php
<?php
// no direct access
defined('_JEXEC') or die('Access to this file is probibited');
class hello_HTML {
function show($name) {
echo 'Welcome ' . $name . ' to our World!';
}
}
?>
can someone tell me what is wrong and how do i correct it?