"$this" in html file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wondershow
Forum Newbie
Posts: 1
Joined: Mon Oct 24, 2005 3:43 am

"$this" in html file

Post by wondershow »

<html>
<body>
<a href="<?php print $this->getFullUrl('abc'); ?>">test</a>
</body>
</html>


"$this" is always used in a class defination to access class object itself.But in the html code,
no object of class is initialized,what does this "$this" mean?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

It won't mean anything, and will probably cause an exception of E_NOTICE error level, most probably of Undefined Variable.

If you are wishing to call upon a class method, without creating an object instance of the class, you can call it statically by using className::methodName()
Post Reply