Wednesday 24 April 2013

Smarty plugin FOR X CART

<?php
/*
* Smarty plugin BY happylifetruelife
* ————————————————————-
* File:     function.recurse_array.php
* Type:     function
* Name:     recurse_array
* Purpose:  prints out elements of an array recursively
* Author:   happylifetruelife
* ————————————————————-
*/

function smarty_function_recurse_array($params, &$smarty)
{
    if (is_array($params['array']) && count($params['array']) > 0)
    {
           $markup = '';
        $markup .= '<ul>';
        foreach ($params['array'] as $element)
        {
                  $markup .= '<li>';$arrow = '';
            if (isset($element['children']) && $element['parent'] > 0){
                $arrow = 'sub-link-2';
            }
             $productcount = '';
            if (array_key_exists('products_count', $element) && $element['parent'] > 0) {
                $productcount = ' ('.$element['products_count'].')';
            }

            $markup .='<a id="tabSr'.$element['id'].'" class="main-tabs '.$arrow.'" href="'.$element['link'].'">'.$element['title'].$productcount.'</a>';
            if (isset($element['children'])) {
                $markup .= smarty_function_recurse_array(array('array' => $element['children']), $smarty);
                  }
            $markup .= '</li>';
           }
           $markup.= '</ul>';
           return $markup;
    }
    else {
       return '';
    }
}

No comments:

Post a Comment

List OF BANK PAN Numbers

List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...