Magento Expert Forum - Improve your Magento experience

Results 1 to 5 of 5

Using $this in magento programming

  1. #1
    Moderator speed2x's Avatar
    Join Date
    Mar 2013
    Location
    Hollywood, Florida, United States
    Posts
    88
    Thanks
    8
    Thanked 7 Times in 6 Posts

    Default Using $this in magento programming

    The infamous $this found in Magento templates is a concept that I’ve found baffles beginner Magento developers. Here’s to hoping I can provide a half-decent explanation as to what it is, and where it comes from.


    The most important point you should take away from this is: all Magento templates have a corresponding block instance. The $this exposed to us is the block instance, as if we were inside a method of the object (We actually are! See Mage_Core_Block_Template::fetchView).

    Blocks are PHP classes that are designed as a place to put all of your business logic, instead of your templates. Blocks are normally reusable classes. A great example of the reusability of certain classes is the Mage_Core_Block_Template and Mage_Page_Block_Html_Pager classes. The core/template block is the foundation of the template system, allowing us the ability to load .phtml files from our themes. The page/html_pager block provides generic methods for paginating collections, such as isLastPage().

    If you’re ever in any doubt as to which block type the template is using, just call echo get_class($this). Remember, it’s an object. This gives you a great place to start when hunting down methods available to the template.

    View more threads in the same category:


  2. #2
    New member
    Join Date
    Mar 2016
    Location
    Walnut,CA USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Magento is an Ecommerce Platform Created On Open Source Technology, which provides online merchants with an exceptional flexibility and control over the content, look and functionality of their e-commerce store.

  3. #3
    Senior Member
    Join Date
    Aug 2018
    Posts
    107
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default

    What is Magento? It's the most powerful online eCommerce platform in the universe and is changing the face of eCommerce forever. :-)
    Of course, you already know that. What you may not realize is Magento's also an object-oriented PHP Framework that can be used to develop modern, dynamic web applications that tap into Magento's powerful eCommerce features.
    This is the first in a series of articles in which we're going to go on a whirlwind tour of Magento's programming framework features

  4. #4
    New member
    Join Date
    Sep 2018
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default nice

    Thanks for the discussion about it.. Very well Written /// Keep it up. https://www.apnacoupon.in/2018/10/pa...n-billpay.html" rel="dofollow">Thanks Againhttps://www.apnacoupon.in/2018/10/pa...n-billpay.html

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •