Mage_Core_Block_Template Class Reference

Inheritance diagram for Mage_Core_Block_Template:

Mage_Core_Block_Abstract Varien_Object Mage_Adminhtml_Block_Abstract Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Ajax_Serializer Mage_Adminhtml_Block_Sales_Order_Create_Load Mage_Adminhtml_Block_Sales_Order_Create_Totals_Default Mage_Adminhtml_Block_Tax_Rate_Title Mage_Adminhtml_Block_Template Mage_Adminhtml_Block_Urlrewrite_Selector Mage_AmazonPayments_Block_Asp_Redirect Mage_AmazonPayments_Block_Asp_Shortcut Mage_AmazonPayments_Block_Link_Shortcut Mage_Catalog_Block_Breadcrumbs Mage_Catalog_Block_Category_View Mage_Catalog_Block_Layer_Filter_Abstract Mage_Catalog_Block_Layer_State Mage_Catalog_Block_Layer_View Mage_Catalog_Block_Navigation Mage_Catalog_Block_Product Mage_Catalog_Block_Product_Abstract Mage_Catalog_Block_Product_Gallery Mage_Catalog_Block_Product_Price Mage_Catalog_Block_Product_View_Additional Mage_Catalog_Block_Product_View_Attributes Mage_Catalog_Block_Product_View_Description Mage_Catalog_Block_Product_View_Options Mage_Catalog_Block_Product_View_Options_Abstract Mage_Catalog_Block_Product_View_Price Mage_Catalog_Block_Product_View_Tabs Mage_Catalog_Block_Seo_Sitemap_Abstract Mage_CatalogSearch_Block_Advanced_Form Mage_CatalogSearch_Block_Advanced_Result Mage_CatalogSearch_Block_Result Mage_CatalogSearch_Block_Term Mage_Checkout_Block_Agreements Mage_Checkout_Block_Cart_Abstract Mage_Checkout_Block_Cart_Item_Renderer Mage_Checkout_Block_Links Mage_Checkout_Block_Multishipping_Abstract Mage_Checkout_Block_Multishipping_Link Mage_Checkout_Block_Multishipping_State Mage_Checkout_Block_Onepage_Abstract Mage_Checkout_Block_Onepage_Failure Mage_Checkout_Block_Onepage_Link Mage_Checkout_Block_Onepage_Success Mage_Checkout_Block_Success Mage_Checkout_Block_Total_Default Mage_Core_Block_Html_Calendar Mage_Core_Block_Html_Date Mage_Core_Block_Messages Mage_Core_Block_Store_Switcher Mage_Core_Block_Template_Facade Mage_Core_Block_Template_Smarty Mage_Core_Block_Template_Zend Mage_Customer_Block_Account Mage_Customer_Block_Account_Dashboard Mage_Customer_Block_Account_Dashboard_Address Mage_Customer_Block_Account_Dashboard_Block Mage_Customer_Block_Account_Dashboard_Hello Mage_Customer_Block_Account_Dashboard_Info Mage_Customer_Block_Account_Dashboard_Newsletter Mage_Customer_Block_Account_Dashboard_Sidebar Mage_Customer_Block_Account_Forgotpassword Mage_Customer_Block_Account_Navigation Mage_Customer_Block_Address_Book Mage_Customer_Block_Form_Login Mage_Customer_Block_Widget_Abstract Mage_Directory_Block_Currency Mage_Directory_Block_Data Mage_Downloadable_Block_Customer_Products_List Mage_GiftMessage_Block_Message_Form Mage_GiftMessage_Block_Message_Helper Mage_GiftMessage_Block_Message_Inline Mage_GoogleCheckout_Block_Link Mage_GoogleOptimizer_Block_Code Mage_Install_Block_Abstract Mage_Install_Block_State Mage_Newsletter_Block_Subscribe Mage_Page_Block_Html Mage_Page_Block_Html_Breadcrumbs Mage_Page_Block_Html_Footer Mage_Page_Block_Html_Head Mage_Page_Block_Html_Header Mage_Page_Block_Html_Notices Mage_Page_Block_Html_Pager Mage_Page_Block_Html_Toplinks Mage_Page_Block_Js_Translate Mage_Page_Block_Redirect Mage_Page_Block_Switch Mage_Page_Block_Template_Container Mage_Page_Block_Template_Links Mage_Payment_Block_Form Mage_Payment_Block_Form_Container Mage_Payment_Block_Info Mage_Payment_Block_Info_Container Mage_Paypal_Block_Express_Review Mage_Paypal_Block_Express_Review_Details Mage_Paypal_Block_Link_Shortcut Mage_PaypalUk_Block_Express_Review Mage_PaypalUk_Block_Express_Review_Details Mage_PaypalUk_Block_Link_Shortcut Mage_Poll_Block_ActivePoll Mage_Poll_Block_Poll Mage_ProductAlert_Block_Email_Abstract Mage_ProductAlert_Block_Price Mage_ProductAlert_Block_Stock Mage_Rating_Block_Entity_Detailed Mage_Review_Block_Customer_Recent Mage_Review_Block_Form Mage_Review_Block_Helper Mage_Rss_Block_Abstract Mage_Rss_Block_List Mage_Rss_Block_Order_Details Mage_Rss_Block_Order_New Mage_Rss_Block_Order_Status Mage_Rss_Block_Wishlist Mage_Sales_Block_Items_Abstract Mage_Sales_Block_Order_Creditmemo Mage_Sales_Block_Order_Details Mage_Sales_Block_Order_Email_Items_Default Mage_Sales_Block_Order_Email_Items_Order_Default Mage_Sales_Block_Order_History Mage_Sales_Block_Order_Info Mage_Sales_Block_Order_Invoice Mage_Sales_Block_Order_Item_Renderer_Default Mage_Sales_Block_Order_Recent Mage_Sales_Block_Order_Shipment Mage_Sales_Block_Order_Tax Mage_Sales_Block_Order_View Mage_Sales_Block_Reorder_Sidebar Mage_Sendfriend_Block_Send Mage_Shipping_Block_Tracking_Ajax Mage_Shipping_Block_Tracking_Popup Mage_Tag_Block_All Mage_Tag_Block_Customer_Edit Mage_Tag_Block_Customer_Recent Mage_Tag_Block_Popular Mage_Tag_Block_Product_List Mage_Wishlist_Block_Customer_Sharing Mage_Wishlist_Block_Links Mage_Wishlist_Block_Share_Email_Items Mage_Wishlist_Block_Share_Email_Rss

List of all members.

Public Member Functions

 getTemplate ()
 getArea ()
 assign ($key, $value=null)
 setScriptPath ($dir)
 getDirectOutput ()
 getShowTemplateHints ()
 fetchView ($fileName)
 renderView ()
 getBaseUrl ()
 getJsUrl ($fileName='')

Protected Member Functions

 _toHtml ()

Protected Attributes

 $_viewDir = ''
 $_viewVars = array()
 $_baseUrl
 $_jsUrl

Static Protected Attributes

static $_showTemplateHints
static $_showTemplateHintsBlocks


Detailed Description

Definition at line 35 of file Template.php.


Member Function Documentation

_toHtml (  )  [protected]

Render block HTML

Returns:
string

Reimplemented from Mage_Core_Block_Abstract.

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Attribute_New_Product_Attributes, Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes_Create, Mage_Adminhtml_Block_Customer_Edit_Tab_Carts, Mage_Adminhtml_Block_Newsletter_Template_Preview, Mage_Adminhtml_Block_Poll_Edit_Tab_Answers_List, Mage_Adminhtml_Block_Rating_Edit_Tab_Form, Mage_Adminhtml_Block_Sales_Items_Column_Name_Grouped, Mage_Adminhtml_Block_Sales_Order_Create_Header, Mage_Adminhtml_Block_Sales_Order_Create_Items, Mage_Adminhtml_Block_Sales_Order_Create_Load, Mage_Adminhtml_Block_Sales_Order_Create_Newsletter, Mage_Adminhtml_Block_Sales_Order_Payment, Mage_Adminhtml_Block_Store_Switcher, Mage_Adminhtml_Block_System_Convert_Profile_Run, Mage_Adminhtml_Block_System_Email_Template_Preview, Mage_Adminhtml_Block_Widget_Accordion_Item, Mage_Adminhtml_Block_Widget_Button, Mage_Adminhtml_Block_Widget_Container, Mage_AmazonPayments_Block_Asp_Shortcut, Mage_AmazonPayments_Block_Link_Shortcut, Mage_Checkout_Block_Cart_Item_Renderer_Grouped, Mage_Checkout_Block_Cart_Sidebar, Mage_Checkout_Block_Multishipping_Link, Mage_Checkout_Block_Multishipping_Payment_Info, Mage_Checkout_Block_Onepage_Payment_Info, Mage_Core_Block_Html_Calendar, Mage_Core_Block_Html_Date, Mage_Core_Block_Messages, Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable, Mage_GoogleCheckout_Block_Link, Mage_GoogleOptimizer_Block_Code, Mage_Page_Block_Html_Breadcrumbs, Mage_Page_Block_Html_Toplinks, Mage_Paypal_Block_Link_Shortcut, Mage_PaypalUk_Block_Link_Shortcut, Mage_Poll_Block_ActivePoll, Mage_Rating_Block_Entity_Detailed, Mage_Reports_Block_Product_Compared, Mage_Reports_Block_Product_Viewed, Mage_Review_Block_Product_View, Mage_Rss_Block_Catalog_Category, Mage_Rss_Block_Catalog_New, Mage_Rss_Block_Catalog_NotifyStock, Mage_Rss_Block_Catalog_Review, Mage_Rss_Block_Catalog_Salesrule, Mage_Rss_Block_Catalog_Special, Mage_Rss_Block_Catalog_Tag, Mage_Rss_Block_Order_New, Mage_Rss_Block_Order_Status, Mage_Rss_Block_Wishlist, Mage_Sales_Block_Order_Email_Items_Order_Grouped, Mage_Sales_Block_Order_Item_Renderer_Grouped, Mage_Sales_Block_Order_Recent, Mage_Sales_Block_Reorder_Sidebar, Mage_Tag_Block_Customer_Recent, Mage_Tag_Block_Popular, and Mage_Wishlist_Block_Customer_Sidebar.

Definition at line 188 of file Template.php.

00189     {
00190         if (!$this->getTemplate()) {
00191             return '';
00192         }
00193         $html = $this->renderView();
00194         return $html;
00195     }

assign ( key,
value = null 
)

Assign variable

Parameters:
string|array $key
mixed $value
Returns:
Mage_Core_Block_Template

Reimplemented in Mage_Core_Block_Template_Zend.

Definition at line 76 of file Template.php.

00077     {
00078         if (is_array($key)) {
00079             foreach ($key as $k=>$v) {
00080                 $this->assign($k, $v);
00081             }
00082         }
00083         else {
00084             $this->_viewVars[$key] = $value;
00085         }
00086         return $this;
00087     }

fetchView ( fileName  ) 

Retrieve block view from file (template)

Parameters:
string $fileName
Returns:
string

Reimplemented in Mage_Core_Block_Template_Zend.

Definition at line 126 of file Template.php.

00127     {
00128         Varien_Profiler::start($fileName);
00129 
00130         extract ($this->_viewVars);
00131         $do = $this->getDirectOutput();
00132 
00133         if (!$do) {
00134             ob_start();
00135         }
00136         if ($this->getShowTemplateHints()) {
00137             echo '<div style="position:relative; border:1px dotted red; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;"><div style="position:absolute; left:0; top:0; padding:2px 5px; background:red; color:white; font:normal 11px Arial; text-align:left !important; z-index:998;" onmouseover="this.style.zIndex=\'999\'" onmouseout="this.style.zIndex=\'998\'" title="'.$fileName.'">'.$fileName.'</div>';
00138             if (self::$_showTemplateHintsBlocks) {
00139                 $thisClass = get_class($this);
00140                 echo '<div style="position:absolute; right:0; top:0; padding:2px 5px; background:red; color:blue; font:normal 11px Arial; text-align:left !important; z-index:998;" onmouseover="this.style.zIndex=\'999\'" onmouseout="this.style.zIndex=\'998\'" title="'.$thisClass.'">'.$thisClass.'</div>';
00141             }
00142         }
00143 
00144         include $this->_viewDir.DS.$fileName;
00145 
00146         if ($this->getShowTemplateHints()) {
00147             echo '</div>';
00148         }
00149 
00150         if (!$do) {
00151             $html = ob_get_clean();
00152         } else {
00153             $html = '';
00154         }
00155         Varien_Profiler::stop($fileName);
00156         return $html;
00157     }

getArea (  ) 

Definition at line 64 of file Template.php.

00065     {
00066         return $this->_getData('area');
00067     }

getBaseUrl (  ) 

Get base url of the application

Returns:
string

Reimplemented in Mage_Page_Block_Html.

Definition at line 202 of file Template.php.

00203     {
00204         if (!$this->_baseUrl) {
00205             $this->_baseUrl = Mage::getBaseUrl();
00206         }
00207         return $this->_baseUrl;
00208     }

getDirectOutput (  ) 

Definition at line 101 of file Template.php.

00102     {
00103         if ($this->getLayout()) {
00104             return $this->getLayout()->getDirectOutput();
00105         }
00106         return false;
00107     }

getJsUrl ( fileName = ''  ) 

Get url of base javascript file

To get url of skin javascript file use getSkinUrl()

Parameters:
string $fileName
Returns:
string

Definition at line 218 of file Template.php.

00219     {
00220         if (!$this->_jsUrl) {
00221             $this->_jsUrl = Mage::getBaseUrl('js');
00222         }
00223         return $this->_jsUrl.$fileName;
00224     }

getShowTemplateHints (  ) 

Definition at line 109 of file Template.php.

00110     {
00111         if (is_null(self::$_showTemplateHints)) {
00112             self::$_showTemplateHints = Mage::getStoreConfig('dev/debug/template_hints')
00113                 && Mage::helper('core')->isDevAllowed();
00114             self::$_showTemplateHintsBlocks = Mage::getStoreConfig('dev/debug/template_hints_blocks')
00115                 && Mage::helper('core')->isDevAllowed();
00116         }
00117         return self::$_showTemplateHints;
00118     }

getTemplate (  ) 

Definition at line 59 of file Template.php.

00060     {
00061         return $this->_getData('template');
00062     }

renderView (  ) 

Render block

Returns:
string

Definition at line 164 of file Template.php.

00165     {
00166         Varien_Profiler::start(__METHOD__);
00167 
00168         $this->setScriptPath(Mage::getBaseDir('design'));
00169         $params = array('_relative'=>true);
00170         if ($area = $this->getArea()) {
00171             $params['_area'] = $area;
00172         }
00173 
00174         $templateName = Mage::getDesign()->getTemplateFilename($this->getTemplate(), $params);
00175 
00176         $html = $this->fetchView($templateName);
00177 
00178         Varien_Profiler::stop(__METHOD__);
00179 
00180         return $html;
00181     }

setScriptPath ( dir  ) 

Set template location dire

Parameters:
string $dir
Returns:
Mage_Core_Block_Template

Reimplemented in Mage_Core_Block_Template_Zend.

Definition at line 95 of file Template.php.

00096     {
00097         $this->_viewDir = $dir;
00098         return $this;
00099     }


Member Data Documentation

$_baseUrl [protected]

Definition at line 52 of file Template.php.

$_jsUrl [protected]

Definition at line 54 of file Template.php.

$_showTemplateHints [static, protected]

Definition at line 56 of file Template.php.

$_showTemplateHintsBlocks [static, protected]

Definition at line 57 of file Template.php.

$_viewDir = '' [protected]

Definition at line 43 of file Template.php.

$_viewVars = array() [protected]

Definition at line 50 of file Template.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:53 2009 for Magento by  doxygen 1.5.8