Magento Forum

   
Phtml files: “this” keyword
 
BoostMyShop
Sr. Member
 
Avatar
Total Posts:  152
Joined:  2008-06-11
France
 

Hello smile

i’m working with phtml files: ok.
However, i dont know to what refers this keyword.

I suspect that it refers to the class name set through the type attribute of block markups…

thanks smile

Olixelle

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brandlive_br
Guru
 
Avatar
Total Posts:  653
Joined:  2008-05-19
Buenos Aires, Argentina
 

$this is the object instance that you’re using.

If you want more php documentation about objects and classes, you can read http://ar2.php.net/manual/en/language.oop5.php.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BoostMyShop
Sr. Member
 
Avatar
Total Posts:  152
Joined:  2008-06-11
France
 
Barbanet - 13 June 2008 06:36 AM

$this is the object instance that you’re using.

If you want more php documentation about objects and classes, you can read http://ar2.php.net/manual/en/language.oop5.php.

hello barbanet

i know what is this object and oop concepts
i’m just trying to know to what object or class is refering this depending of the phtml file

thanls

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brandlive_br
Guru
 
Avatar
Total Posts:  653
Joined:  2008-05-19
Buenos Aires, Argentina
 

Sorry, I misunderstood your post.
Well, you can try with

<?php

class foo {
    
function name()
    
{
        
echo "My name is " get_class($this) , "\n";
    
}
}

// create an object
$bar = new foo();

// external call
echo "Its name is " get_class($bar) , "\n";

// internal call
$bar->name();

?>

More class functions at: http://ar2.php.net/manual/en/function.get-class.php

If this can’t help you, I’m gonna think that it’s too much english for me on friday.
wink

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top