I am working on a set of ASP.Net style server controls to use a framework for interacting in a more meaningful and intuitive way, with forms and MySQL. In ASP, setting the Id attribute of a control makes it immediately available for use elsewhere by referring to the id.
i.e.
[code=php]<form runat=”server”>
<asp:Image id=”img1″></asp:Image>
</form>
<script runat=”server”>
Sub Page_Load
img1.src = “foo.jpg”
End Sub
</script>
I already can access the attribute (which are stored in an array) simply by running
[code=php]$markup = “<span class=’foo’>text</span>”
$e = new Element($markup);
$e->id = “myspan”
print $e;
// this will print the following:
//<span class=”foo” name=”myspan”>text</span>
I tried the following, which did not work (right now, I am calling $e->Register() explicitly):
[code=php]class Element
{
//…
public function Register()
{
global ${$this->id};
${this->id} =& $this;
}
//…
}
Does anyone have any ideas?