Date: 04/26/01
- Next message: Pascal Jolin: "Re: [phplib] Class declaration may not be nested..."
- Previous message: Pascal Jolin: "Re: [phplib] I need relogin?"
- In reply to: Prasad RL: "[phplib] Class declaration may not be nested..."
- Next in thread: Pascal Jolin: "Re: [phplib] Class declaration may not be nested..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I believe its because your requiring the template.inc inside the class
function you are actually defining the template class inside your myClass.
require does the equivalent of a cut and paste, so you have just pasted the
whole template.inc into the middle of your class declaration.
Thinking about it this couldn't work for other reasons, not least because
each time you called printSomething it would try to re-require the file and
give you errors.
try moving the require up outside the declaration of your class, and use
require_once (if using php4), eg:
require_once "template.inc";
class myClass {
function printSomething($str) {
$t = new Template();
echo "$str";
}
}
Adam Robertson
Internet Developer
Random Media
14 South Audley Street
Mayfair
London W1K 1HN
t.+44 (0)20 7923 4298
f.+44 (0)20 7598 8826
www.randommedia.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Pascal Jolin: "Re: [phplib] Class declaration may not be nested..."
- Previous message: Pascal Jolin: "Re: [phplib] I need relogin?"
- In reply to: Prasad RL: "[phplib] Class declaration may not be nested..."
- Next in thread: Pascal Jolin: "Re: [phplib] Class declaration may not be nested..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

