Mage_Page_Block_Html_Toplinks Class Reference

Inheritance diagram for Mage_Page_Block_Html_Toplinks:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 addLink ($liParams, $aParams, $innerText, $position='', $beforeText='', $afterText='')

Protected Member Functions

 _toHtml ()

Protected Attributes

 $_toplinks = array()


Detailed Description

Definition at line 34 of file Toplinks.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 55 of file Toplinks.php.

00056     {
00057         parent::__construct();
00058         $this->setTemplate('page/html/top.links.phtml');
00059     }


Member Function Documentation

_toHtml (  )  [protected]

Render block HTML

Returns:
string

Reimplemented from Mage_Core_Block_Template.

Definition at line 104 of file Toplinks.php.

00105     {
00106         if (is_array($this->_toplinks) && $this->_toplinks) {
00107             reset($this->_toplinks);
00108             $this->_toplinks[key($this->_toplinks)]['first'] = true;
00109             end($this->_toplinks);
00110             $this->_toplinks[key($this->_toplinks)]['last'] = true;
00111         }
00112         $this->assign('toplinks', $this->_toplinks);
00113         return parent::_toHtml();
00114     }

addLink ( liParams,
aParams,
innerText,
position = '',
beforeText = '',
afterText = '' 
)

Add link

Parameters:
string|array $liParams
string|array $aParams
string $innerText
int $position
string $beforeText
string $afterText
Returns:
Mage_Page_Block_Html_Toplinks

Definition at line 72 of file Toplinks.php.

00073     {
00074         $params = '';
00075         if (!empty($liParams) && is_array($liParams)) {
00076             foreach ($liParams as $key=>$value) {
00077                 $params .= ' ' . $key . '="' . addslashes($value) . '"';
00078             }
00079         } elseif (is_string($liParams)) {
00080             $params .= ' ' . $liParams;
00081         }
00082         $toplinkInfo['liParams'] = $params;
00083         $params = '';
00084         if (!empty($aParams) && is_array($aParams)) {
00085             foreach ($aParams as $key=>$value) {
00086                 $params .= ' ' . $key . '="' . addslashes($value) . '"';
00087             }
00088         } elseif (is_string($aParams)) {
00089             $params .= ' ' . $aParams;
00090         }
00091         $toplinkInfo['aParams'] = $params;
00092         $toplinkInfo['innerText'] = $innerText;
00093         $toplinkInfo['beforeText'] = $beforeText;
00094         $toplinkInfo['afterText'] = $afterText;
00095         $this->_prepareArray($toplinkInfo, array('liParams', 'aParams', 'innerText', 'beforeText', 'afterText', 'first', 'last'));
00096         if (is_numeric($position)) {
00097             array_splice($this->_toplinks, $position, 0, array($toplinkInfo));
00098         } else {
00099             $this->_toplinks[] = $toplinkInfo;
00100         }
00101         return $this;
00102     }


Member Data Documentation

$_toplinks = array() [protected]

Definition at line 53 of file Toplinks.php.


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

Generated on Sat Jul 4 17:24:30 2009 for Magento by  doxygen 1.5.8