Date: 04/26/01
- Next message: Lazaro Ferreira: "[phplib] db_sql class issue"
- Previous message: Adam Robertson: "RE: [phplib] Class declaration may not be nested..."
- In reply to: Prasad RL: "[phplib] Class declaration may not be nested..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
template.inc includes the declaration for the Template class.
including it inside your myClass definition is illegal (you can't
define a class inside a class, that's what the error message
tells you).
Try:
require("template.inc");
class myClass {
function printSomething($str) {
$t = new Template();
echo "$str";
}
}
myClassObject = new myClass();
myClassObject.printSomething("hello world");
----- Original Message -----
From: "Prasad RL" <rlsp <email protected>>
To: <phplib <email protected>>
Sent: Thursday, April 26, 2001 9:30 AM
Subject: [phplib] Class declaration may not be nested...
>
> I get an error that says "Class declarations may not be nested in test.php
on line 4".
>
> Here's an example code to explain the problem. The error is in this part
of code where there's a call to create a new instance of Template Class. for
example,
>
> class myClass {
> function printSomething($str) {
> require "template.inc";
> $t = new Template();
> echo "$str";
> }
> }
>
> A call to above function printSomething() displays that error message.
>
> What is the cause of this problem ? I'm using php 4.0.1pl1 and phplib
7.2c.
>
> Any help would be highly appreaciated.
>
> Thanks,
>
> Sivaprasad R.L
>
>
> _____________________________________________________
> Chat with your friends as soon as they come online. Get Rediff Bol at
> http://bol.rediff.com
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Lazaro Ferreira: "[phplib] db_sql class issue"
- Previous message: Adam Robertson: "RE: [phplib] Class declaration may not be nested..."
- In reply to: Prasad RL: "[phplib] Class declaration may not be nested..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

