MidgardRocks has name
Posted on 2005-02-04 23:38:17 EET.
Let me write code's part unformatted as this won't break anything.
Define object.
<type name="MidgardRocks">
<property name="name" type="string"/>
<property name="info" type="string"/>
</type>
Write testing PHP code.
<?php
$amerigard = new MidgardRocks();
print_r($amerigard);
print "<p>";
$amerigard->name = "Midgard is cool";
print_r($amerigard);
?>
Request page.
MidgardRocks Object ( [id] => [sitegroup] => [author] => [owner] => [realm] => [guid] => [changed] => [updated] => [action] => [name] => [info] => )
MidgardRocks Object ( [id] => [sitegroup] => [author] => [owner] => [realm] => [guid] => [changed] => [updated] => [action] => [name] => Midgard is cool [info] => )
You still want to ask about these all undefined properties in xml file?
This is simple. MidgardRocks by default inherits MgdRpd object which has these properties defined.
You do not really need to worry about them.
Code works , but is unstable. I need to find out if there is some other way to define class members.
If not, we need to call class constructor only when object is initialized, so by default all objects called
with new Object will be empty. I am starting to wonder if this is good idea anyway.