Jump to content


Photo

recursive assign?


  • Please log in to reply
No replies to this topic

#1 bcoffin

bcoffin
  • Members
  • PipPipPip
  • Advanced Member
  • 130 posts

Posted 29 August 2006 - 09:05 PM

Does anybody know a good script to recursively process/assign smarty variables?
This is what I'd like to do...

foreach($vals as $k=>$v) {
  if(is_array($v))
  {
    foreach($v as $ak=>$av)
    {
        $this->smarty->assign(array($k[$ak] => strtoupper($av)));
    }
  }
  else
  {
      $this->smarty->assign(array($k => strtoupper($v)));
  }
}

..however, I would like it to process all levels of an array, no matter how deep... ideas?
Ben Coffin
bcoffin@hotmail.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users