Skip to content

Instantly share code, notes, and snippets.

@shiki
Forked from ferower/gist:1408279
Created November 30, 2011 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiki/1408295 to your computer and use it in GitHub Desktop.
Save shiki/1408295 to your computer and use it in GitHub Desktop.
public static function getSubTopicIdsOfTopic($topicId, &$topics = null)
{
$list = array();
if (empty($topics))
$topics = PTopic::model()->findAll();
foreach ($topics as $key => $topic) {
if ($topic->parentId == $topicId) {
$list[] = $topic->id;
$list = array_merge($list, self::getSubTopicIdsOfTopic($topic->id, $topics));
}
}
return $list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment